0
votes

I'm learning how to create a logo uploader in WordPress so I can upload my own logo to my WordPress website using the customizer.

Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'wpt_register_theme_customizer' not found or invalid function name in /Users/brandonpowell/sites/valet/wordpress-development/web/wp/wp-includes/class-wp-hook.php on line 298

I'm running to issue on every tutorial and blog post how to create a logo Upload I run into the same error message every time. Can someone explain to me what the best method to creating a logo uploader.

function wpt_register_theme_customizer( $wp_customize ) {
  // Add Custom Logo Settings
  $wp_customize->add_section( 'custom_logo' , array(
    'title'      => __('Change Your Logo','wptthemecustomizer'),
    'panel'      => 'design_settings',
    'priority'   => 20
  ) );
  $wp_customize->add_setting(
      'wpt_logo',
      array(
          'default'         => get_template_directory_uri() . '/images/logo.png',
          'transport'       => 'postMessage'
      )
  );
  $wp_customize->add_control(
       new My_Customize_Image_Reloaded_Control(
           $wp_customize,
           'custom_logo',
           array(
               'label'      => __( 'Change Logo', 'wptthemecustomizer' ),
               'section'    => 'custom_logo',
               'settings'   => 'wpt_logo',
               'context'    => 'wpt-custom-logo'
           )
       )
   );


 }
 add_action( 'customize_register', 'wpt_register_theme_customizer' );
1

1 Answers

1
votes

Are you using a namespace in this file? If so you need to include the namespace in the function name like so:

add_action( 'customize_register', __NAMESPACE__ . '\\wpt_register_theme_customizer' );