Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
See Post Related Meta in a side metabox
<?php
/**
* Show Post Meta in a metabox
*/
add_action( 'add_meta_boxes', 'wpdocs_register_meta_boxes' );
function wpdocs_register_meta_boxes() {
add_meta_box(
'meta-box-id',
'Information Box',
'display_post_meta_data_callback',
'sb-people-listing', // Change the post-type here.
'side',
'high'
);
}
function display_post_meta_data_callback(){
// global $post;
// $post_id = $post->ID;
echo '<pre>';
var_dump( get_post_meta(get_the_ID()) );
echo '</pre>';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment