get_post_meta_by_id() WordPress Function

The get_post_meta_by_id() function allows you to retrieve post meta data by post ID. This is useful if you need to access post meta data for a specific post, outside of the normal post loop.

get_post_meta_by_id( int $mid ) #

Returns post meta data by meta ID.


Parameters

$mid

(int)(Required)


Top ↑

Return

(object|bool)


Top ↑

Source

File: wp-admin/includes/post.php

function get_post_meta_by_id( $mid ) {
	return get_metadata_by_mid( 'post', $mid );
}


Top ↑

Changelog

Changelog
VersionDescription
2.1.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More