Last active
November 5, 2021 05:14
-
-
Save bahiirwa/664abd3e7aa8270817bb4da4aea9694a to your computer and use it in GitHub Desktop.
See Post Related Meta in a side metabox
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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