I want to get post ID within Post page. I need this for custom meta box so i can set the id in shortcode. I can show the result in notices but don't know how to make it global to use for meta input. What i got till now is :
function foo(){
global $post;
$nid = $post->ID;
var_dump($nid);
}
add_action( 'admin_notices', 'foo' );
which show the id but i need it as a variable so i can use it later. so i tried to make $nid
global then echo it but it show nothing.
echo $nid;
orecho $GLOBALS["nid"]
?get_the_ID()
within meta box.