Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am fooling around with the Customizer code for the first time. The end goal will be to add some options to a plugin. I am off to a bad start because even adding the most basic code is throwing an error (Sorry I am new user here and I tried about 100 times to add the code below properly but it didn't work???)...

Fatal error: Call to a member function add_setting() on a non-object in... (my path)

Here is the basic code I am using (keeping in mind this is a plugin and not a theme)

function mb_wp_logo_customize_register ($wp_customize) {
    //Settings, Sections, and Controls are defined here
}
add_action( 'customize_register', 'mb_wp_logo_customize_register' );


$wp_customize->add_setting( 'link_color' , array(
    'default'           => 'FF00FF',
    'type'              => 'option',
    'transport'         => 'refresh',
    'sanitize_callback' => 'sanitize_hex_color_no_hash',
));

$wp_customize->add_section( 'customizer_content_customizations' , array(
    'title'           => __('Content Customizations', 'wplogocustomizer'),
    'description'     => __('Customize the colors', 'wplogocustomizer'),
    'priority'        => 30,
));
share|improve this question

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.