2017-09-08 38 views
0

私は、次のエラーが直面しています: 致命的なエラー:不明なエラーを:(未定義の関数add_actionに呼び出し)致命的なエラー:不明なエラー:未定義の関数add_actionに呼び出し()エラー

ここに私のコードは

function testtheme_add_admin_page(){ 
add_menu_page('testtheme custom options', 'testtheme', 'manage_options', 
'testtheme_theme_create_page', 'dashicons-admin-generic', 110); 
} 

add_action('admin_menu', 'testtheme_add_admin_page'); 

function testtheme_theme_create_page(){ 
    //create custom options page 
} 
です
+1

上のメニュー-スラグを入れていませんか?またはfunctions.phpで? –

+0

functions.phpで – Ali

答えて

0

関数を実行する前にまずwp-load.phpファイルを呼び出す必要があると思います。

はちょうどあなたのファイルの先頭に行の下に電話し、再度実行してください:

dirname(__FILE__)www.yourdomain.com/wordpress/

のようなたとえば、ルートWordPressのディレクトリをポイントである
require(dirname(__FILE__) . '/wp-load.php'); 

これはあなたに役立つことを願っています。ありがとう。

0

ブロあなただけのプラグインファイルではあり

function testtheme_add_admin_page(){ 
add_menu_page('testtheme custom options', 'testtheme', 'manage_options', 
'testtheme',  
'testtheme_theme_create_page', 'dashicons-admin-generic', 110); 
} 

add_action('admin_menu', 'testtheme_add_admin_page'); 

function testtheme_theme_create_page(){ 
//create custom options page 
echo "test";  
} 
関連する問題