Is_page() function when editing pages

If I am calling the is_page() function like so:

if( is_page(array(6601,4937,4977,4940)) ) {
    //some code
}

Why does it not work correctly on pages like this:
/x/#/content/4940/inspector

Hi @aaron_softwarepromot

Check this graph, you will notice that wp_query object can be called only after template_redirect action is fired, since is_page depends on that query object, hence it can’t be used on admin pages.

Thanks.

What could I call instead of the is_page() function to identify specific pages with a specific ID?

Thanks and I look forward to your reply.

Hello There,

There is no equivalent function to view pages in the admin area. Please check out the rest of the condition functions from this codex: https://codex.wordpress.org/Function_Reference/is_admin

Hope this helps.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.