最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

theme development - function 'theme_settings_page' not found

programmeradmin0浏览0评论

I want to add change apearance setting to my theme and I am using this code:

//admin pannel
function theme_settings_init(){
    register_setting( 'theme_settings', 'theme_settings' );
}
//افزودن تنظیمات به منوی پیشخوان
function add_settings_page() {
    add_menu_page( __( 'تنظیمات'  ), __( 'تنظیمات'  ), 'manage_options', 'settings', 'theme_settings_page');
}

add_action( 'admin_init', 'theme_settings_init' );
add_action( 'admin_menu', 'add_settings_page' );

and there is an error: " Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'theme_settings_page' not found or invalid function name "

can anyone help me to fix it?

I want to add change apearance setting to my theme and I am using this code:

//admin pannel
function theme_settings_init(){
    register_setting( 'theme_settings', 'theme_settings' );
}
//افزودن تنظیمات به منوی پیشخوان
function add_settings_page() {
    add_menu_page( __( 'تنظیمات'  ), __( 'تنظیمات'  ), 'manage_options', 'settings', 'theme_settings_page');
}

add_action( 'admin_init', 'theme_settings_init' );
add_action( 'admin_menu', 'add_settings_page' );

and there is an error: " Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'theme_settings_page' not found or invalid function name "

can anyone help me to fix it?

Share Improve this question asked May 31, 2020 at 6:51 hadishadis 212 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

call_user_func_arry is a PHP function call back with array of parameters. Nothing mush to do with that.
Your function theme_settings_page is not defined. So please define that function and you will get rid of the error. Illustrated below...

//admin pannel
function theme_settings_init(){
    register_setting( 'theme_settings', 'theme_settings' );
}
//افزودن تنظیمات به منوی پیشخوان
function add_settings_page() {
    add_menu_page( __( 'تنظیمات'  ), __( 'تنظیمات'  ), 'manage_options', 'settings', 'theme_settings_page');
}
function theme_settings_page(){
    // code goes here
}
add_action( 'admin_init', 'theme_settings_init' );
add_action( 'admin_menu', 'add_settings_page' );
发布评论

评论列表(0)

  1. 暂无评论