我正在尝试从特定页面中删除屏幕选项而且我有一些东西可以从所有页面中删除屏幕选项,所以我只需要检查“当页面== {x}时”如何查看哪个页面我在wordpress上了吗?
function remove_screen_options(){
return false;
}
add_filter('screen_options_show_screen', 'remove_screen_options');
以为它会像以下一样简单:
function remove_screen_options(){
global $pagename;
if( $pagename == "admin_faucet_settings") {
return false;
}
}
add_filter('screen_options_show_screen', 'remove_screen_options');
但这不起作用 - 似乎一直都是火,这是奇怪的,而且......任何想法?
答案 0 :(得分:1)
所以,如果您需要定位wordpress管理区域的任何特定页面,例如插件页面,那么您可以使用这样的admin enqueue脚本钩子:
function my_admin_enqueue($hook_suffix) {
if($hook_suffix == 'faucet_admin_settings') {
// your code that should be executed if we are on the right page.
}
}
add_action('admin_enqueue_scripts', 'my_admin_enqueue');