您应该能够更改create\\u函数(“$a”,“return null;”)到Anonymous Function (又名闭包):
From :
add_theme_page(
$this->args[\'page_slug\'],
__(\'Dev Mode Info\', \'nhp-opts\'),
__(\'Dev Mode Info\', \'nhp-opts\'),
$this->args[\'page_cap\'],
$this->args[\'page_slug\'].\'&tab=dev_mode_default\',
create_function( \'$a\', "return null;" )
);
To : add_theme_page(
$this->args[\'page_slug\'],
__(\'Dev Mode Info\', \'nhp-opts\'),
__(\'Dev Mode Info\', \'nhp-opts\'),
$this->args[\'page_cap\'],
$this->args[\'page_slug\'].\'&tab=dev_mode_default\',
function($a){ return null; }
);
完整代码更改:
function _options_page(){
if($this->args[\'page_type\'] == \'submenu\'){
if(!isset($this->args[\'page_parent\']) || empty($this->args[\'page_parent\'])){
$this->args[\'page_parent\'] = \'themes.php\';
}
$this->page = add_theme_page(
$this->args[\'page_parent\'],
$this->args[\'page_title\'],
$this->args[\'menu_title\'],
$this->args[\'page_cap\'],
$this->args[\'page_slug\'],
array(&$this, \'_options_page_html\')
);
}else{
$this->page = add_theme_page(
$this->args[\'page_title\'],
$this->args[\'menu_title\'],
$this->args[\'page_cap\'],
$this->args[\'page_slug\'],
array(&$this, \'_options_page_html\'),
$this->args[\'menu_icon\'],
$this->args[\'page_position\']
);
if(true === $this->args[\'allow_sub_menu\']){
//this is needed to remove the top level menu item from showing in the submenu
add_theme_page(
$this->args[\'page_slug\'],
$this->args[\'page_title\'],
\'\',
$this->args[\'page_cap\'],
$this->args[\'page_slug\'],
function($a){ return null; }
);
foreach($this->sections as $k => $section){
add_theme_page(
$this->args[\'page_slug\'],
$section[\'title\'],
$section[\'title\'],
$this->args[\'page_cap\'],
$this->args[\'page_slug\'].\'&tab=\'.$k,
function($a){ return null; }
);
}
if(true === $this->args[\'show_import_export\']){
add_theme_page(
$this->args[\'page_slug\'],
__(\'Import / Export\', \'nhp-opts\'),
__(\'Import / Export\', \'nhp-opts\'),
$this->args[\'page_cap\'],
$this->args[\'page_slug\'].\'&tab=import_export_default\',
function($a){ return null; }
);
}//if
foreach($this->extra_tabs as $k => $tab){
add_theme_page(
$this->args[\'page_slug\'],
$tab[\'title\'],
$tab[\'title\'],
$this->args[\'page_cap\'],
$this->args[\'page_slug\'].\'&tab=\'.$k,
function($a){ return null; }
);
}
if(true === $this->args[\'dev_mode\']){
add_theme_page(
$this->args[\'page_slug\'],
__(\'Dev Mode Info\', \'nhp-opts\'),
__(\'Dev Mode Info\', \'nhp-opts\'),
$this->args[\'page_cap\'],
$this->args[\'page_slug\'].\'&tab=dev_mode_default\',
function($a){ return null; }
);
}//if
}//if
}//else
add_action(\'admin_print_styles-\'.$this->page, array(&$this, \'_enqueue\'));
add_action(\'load-\'.$this->page, array(&$this, \'_load_page\'));
}//function