• Hey people,

    I’m wondering if there is any way to check if one is editing a page or a post from the WordPress backend. I’ve added some custom boxes to the post/page edit page, but I’d like to show some of these only on the add/edit post page, and some on the edit/add page screen. Is there any way to achieve this?

    Thnx!

Viewing 1 replies (of 1 total)
  • jespert

    (@jespert)

    This?

    if(strstr($_SERVER['REQUEST_URI'], 'wp-admin/post-new.php') || strstr($_SERVER['REQUEST_URI'], 'wp-admin/post.php') || strstr($_SERVER['REQUEST_URI'], 'wp-admin/edit.php')) {
        //Post
    }else{
        //Page
    }
Viewing 1 replies (of 1 total)
  • The topic ‘Check if editing post or page?’ is closed to new replies.