WordPress.org

Ready to get started?Download WordPress

Forums

Developer's Custom Fields
Post ID within register function (1 post)

  1. ch8rt
    Member
    Posted 2 years ago #

    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/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.