- This topic has 10 replies, 2 voices, and was last updated 3 months, 3 weeks ago by .
I created a meta box and I need to get the id of the current post as a value with the parameter 'attributes' :
array( 'id' => $prefix . 'hidden_postid', 'type' => 'hidden', 'attributes' => array( 'value' => $post_id, ) ),
First I used this :
global $post; $post_id = $post->ID;
But it doesn't seem to work.
The function get_the_ID() doesn't work either however I use the 'value' => date() for another field and it's working...
Thank you 🙂
- You must be logged in to reply to this topic.