I’m trying to get the ID of the post being edited from within the register_my_custom_fields function, and having tried a number of different methods I’ve hit a brick wall.
global $post; $post_id = $post->ID;
global $post; $post_id = ($post_id)?($post_id):($post->ID);
global $wp_query; $post_id = $wp_query->post->ID;
$post_id = the_ID();
But as I said before, its always blank.
The reason for wanting the ID at this stage is so I can check on the value of other meta fields and show additional fields in response.
- The topic ‘[Plugin: Developer's Custom Fields] Post ID within register function’ is closed to new replies.