WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have theme options saved as serialized data. And I have named the option name by getting theme name.

$theme = wp_get_theme();
$settings = sanitize_title($theme).'-options'; // do not change!

But when I am trying to pass the $settings variable with or without concatenation. It ends up with this fatal error.

Fatal error: Call to a member function check_capabilities() on a non-object in C:\Users\SISIR\Dropbox\wamp\www\l\wp-includes\class-wp-customize-control.php on line 160

Check the $settings.'[skin'] section which doesn't work but when I replace that part of the code with 'lead_capture_theme_option[skin]', it works. The fatal error itself is also puzzling.

    add_action( 'customize_register', 'lead_capture_theme_customize_register', 11 );

    function lead_capture_theme_customize_register($wp_customize) {

        $theme = wp_get_theme();
        $settings = sanitize_title($theme).'-options'; // do not change!
    //  var_dump($settings);

        $wp_customize->add_section( 'lead_cap_color_scheme', array(                                             'title'          => __( 'Color Scheme', 'themename' ),
        'priority'       => 35

        $wp_customize->add_setting( $settings.'[skin]', array(                                              'default'        => 'light',
        'type'           => 'theme_mod',
        'capability'     => 'edit_theme_options'                                            )

        $wp_customize->add_control( 'lead_capture_theme_option[skin]', array(                                               'label'        => 'Select a Color Scheme',
        'type'           => 'select',
        'choices' => array('default', 'custom'),
        'section' => 'lead_cap_color_scheme',
        'settings' => 'lead_capture_theme_option[skin]'
                                                $wp_customize->add_setting( 'lead_capture_theme_option[logo]', array(
                'type'           => 'theme_mod',
                'capability'     => 'edit_theme_options'

                                                                new WP_Customize_Image_Control( $wp_customize, 'lead_capture_theme_option[logo]', array(
                    'label'   => 'Upload Logo',
                    'section' => 'lead_cap_color_scheme'
share|improve this question
Do you save your settings using the Settings API (register_setting() or the Theme Mods API (set_theme_mod())? Either way, can you post the relevant register_setting() and/or set_theme_mod() code? – Chip Bennett Feb 11 '13 at 13:20
@ChipBennett: Got it! Thanks!! :) – Sisir Feb 11 '13 at 13:44
up vote 2 down vote accepted

Thanks to @chip_bennett to point it out!

I registered the settings using settings api and I was trying to add the settings on customize api by the type of theme_mod that's why it was showing the error. After changing the 'type' => 'theme_mod' to 'type' => 'option', it worked :)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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