I have read the codex, but found it a bit incomplete. I like to load stuff only on pages where the post editor is visible. This should include custom post types and everything.
I am a bit insure about the get_current_screen()
Object. When to use base
, parent_base
…
Would this be the right check? Tested it on pages and posts and seem to be working. Just asking because I am curious if I could to this better.
$screen = get_current_screen();
if ( 'post' == $screen->base || 'page' == $screen->base ) {
// Load stuff
}
Inspect the global variable
$pagenow
, and usepost_type_supports()
to find post types with an editor: