//function.php
if($current_screen->post_type == 'xxx') {
…
}
前使ったときは大丈夫だったじゃん・・・
なんなん・・・と思って調べたら、こういう感じに書けばいいらしい。
//function.php
if(isset($current_screen) && $current_screen->post_type == 'xxx') {
…
}
参考:https://wordpress.org/support/topic/fix-for-undefined-current_screen/