admin管理员组

文章数量:1335412

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' );

本文标签: theme developmentfunction 39themesettingspage39 not found