Title: [Plugin: Developer&#039;s Custom Fields] Post ID within register function
Last modified: August 20, 2016

---

# [Plugin: Developer's Custom Fields] Post ID within register function

 *  [ch8rt](https://wordpress.org/support/users/ch8rt/)
 * (@ch8rt)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/plugin-developers-custom-fields-post-id-within-register-function/)
 * Hi guys,
 * 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.
 * I’ve tried…
    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.
 * Any ideas?
 * [http://wordpress.org/extend/plugins/developers-custom-fields/](http://wordpress.org/extend/plugins/developers-custom-fields/)

The topic ‘[Plugin: Developer's Custom Fields] Post ID within register function’
is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/developers-custom-fields.svg)
 * [Developer's Custom Fields](https://wordpress.org/plugins/developers-custom-fields/)
 * [Support Threads](https://wordpress.org/support/plugin/developers-custom-fields/)
 * [Active Topics](https://wordpress.org/support/plugin/developers-custom-fields/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/developers-custom-fields/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/developers-custom-fields/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [ch8rt](https://wordpress.org/support/users/ch8rt/)
 * Last activity: [13 years, 10 months ago](https://wordpress.org/support/topic/plugin-developers-custom-fields-post-id-within-register-function/)
 * Status: not resolved