Skip to content

Instantly share code, notes, and snippets.

@bahiirwa
Last active November 5, 2021 05:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bahiirwa/664abd3e7aa8270817bb4da4aea9694a to your computer and use it in GitHub Desktop.
Save bahiirwa/664abd3e7aa8270817bb4da4aea9694a to your computer and use it in GitHub Desktop.
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