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?

1 Answer 1

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.