I use the conditonal function is_singular($my_post_type) inside my plugin and it is very convenient.
The problem is that is doesn’t work backend.
Is there an alternative that works frontend & backend ?
Thanks !
3 Answers
Here’s what I use now:
function custom_singular_backend(){
$screen = get_current_screen();
if ( ( $screen->base == 'post' ) && ( $screen->post_type == POSTTYPE ) ){
//...
}
}
add_action( 'current_screen','custom_singular_backend');