• Hi,

    I am writing a plugin for edit page and I need to get current page id. How to get it?

    I tried get_post_id() functions which doesnt work for me. Any other suggestions?

    Thanks in advance !

    Snehal

Viewing 2 replies - 1 through 2 (of 2 total)
  • In most context there is a global variable called $post. It is general variable for any post (post, page, any custom post type). If you include the statement:

    global $post;
    

    And the current post is available for the current context, you can get the ID by accessing its ID property:

    $post->ID;
    
    Thread Starter snehalpatil

    (@snehalpatil)

    Thank you so much ! I got it worked ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to get pageid ?’ is closed to new replies.