• Resolved sleeplessindc

    (@sleeplessindc)


    I’ve started getting the following in the php_errorlog:

    call_user_func_array() expects parameter 1 to be a valid callback, function ‘twentyseventeen_widgets_init’ not found or invalid function name in /home/botani05/public_html/botanical-art/wp-includes/class-wp-hook.php on line 286

    I found twentyseventeen_widgets_init in the functions file for the Register widget area

    function twentyseventeen_widgets_init() {
    	register_sidebar( array(
    		'name'          => __( 'Blog Sidebar', 'twentyseventeen' ),
    		'id'            => 'sidebar-1',
    		'description'   => __( 'Add widgets here to appear in your sidebar on blog posts and archive pages.', 'twentyseventeen' ),
    		'before_widget' => '<section id="%1$s" class="widget %2$s">',
    		'after_widget'  => '</section>',
    		'before_title'  => '<h2 class="widget-title">',
    		'after_title'   => '</h2>',
    	) );
    

    series of more sidebar names
    add_action( 'widgets_init', 'twentyseventeen_widgets_init' );

    But cannot find where call_user_func_array() is used. What is causing this problem?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Are you looking in the theme’s files because you haven’t made any modifications? If so, try deactivating all of your plugins to explore whether any could be responsible.

    Thread Starter sleeplessindc

    (@sleeplessindc)

    I have a child theme that does add some additional widgets but that code is in the same format as in the theme functions.php file:

    /* Find out which sidebars are active */
    
    $num_of_sidebars = (int) is_active_sidebar( 'first-footer-widget-area' ) + (int) is_active_sidebar( 'second-footer-widget-area' ) + (int) is_active_sidebar( 'third-footer-widget-area' ) + (int) is_active_sidebar( 'fourth-footer-widget-area' ) + (int) is_active_sidebar( 'sidebar-copyright' );
    
    /**
     * Register more widget areas.
     *
     * @link https://code.tutsplus.com/tutorials/dynamically-adding-four-footer-widget-areas--cms-22168
     */
        // First footer widget area, located in the footer. Empty by default.
        register_sidebar( array(
            'name' => __( 'First Footer Widget Area', 'twentyseventeen' ),
            'id' => 'first-footer-widget-area',
            'description' => __( 'The first footer widget area', 'twentyseventeen' ),
            'before_widget' => '<div id="%1$s" class="widget-container %2$s">',
            'after_widget' => '</div>',
            'before_title' => '<h3 class="widget-title">',
            'after_title' => '</h3>',
        ) );
     
        // Second Footer Widget Area, located in the footer. Empty by default.
        register_sidebar( array(
            'name' => __( 'Second Footer Widget Area', 'twentyseventeen' ),
            'id' => 'second-footer-widget-area',
            'description' => __( 'The second footer widget area', 'twentyseventeen' ),
            'before_widget' => '<div id="%1$s" class="widget-container %2$s">',
            'after_widget' => '</div>',
            'before_title' => '<h3 class="widget-title">',
            'after_title' => '</h3>',
        ) );
     
        // Third Footer Widget Area, located in the footer. Empty by default.
        register_sidebar( array(
            'name' => __( 'Third Footer Widget Area', 'twentyseventeen' ),
            'id' => 'third-footer-widget-area',
            'description' => __( 'The third footer widget area', 'twentyseventeen' ),
            'before_widget' => '<div id="%1$s" class="widget-container %2$s">',
            'after_widget' => '</div>',
            'before_title' => '<h3 class="widget-title">',
            'after_title' => '</h3>',
        ) );
     
        // Fourth Footer Widget Area, located in the footer. Empty by default.
        register_sidebar( array(
            'name' => __( 'Fourth Footer Widget Area', 'twentyseventeen' ),
            'id' => 'fourth-footer-widget-area',
            'description' => __( 'The fourth footer widget area', 'twentyseventeen' ),
            'before_widget' => '<div id="%1$s" class="widget-container %2$s">',
            'after_widget' => '</div>',
            'before_title' => '<h3 class="widget-title">',
            'after_title' => '</h3>',
        ) );
     
        // Copyright Footer Widget Area, located in the footer. Empty by default.
    	register_sidebar( array(
    		'name'          => __( 'Copyright area', 'twentyseventeen' ),
    		'id'            => 'sidebar-copyright',
    		'description'   => __( 'Place a text widget in this area and add your copyright text', 'twentyseventeen' ),
            'before_widget' => '<div id="%1$s" class="widget-container %2$s">',
            'after_widget' => '</div>',
            'before_title' => '',
            'after_title' => '',
    	) );
    
    function get_my_widget_title() {
        $my_widget_title = 'Copyright';
        return null;
    }
    
    // Register sidebars by running twentyseventeen_widgets_init() on the widgets_init hook.
    add_action( 'widgets_init', 'twentyseventeen_widgets_init' );
    
    Thread Starter sleeplessindc

    (@sleeplessindc)

    Several plugins use call_user_func_array. This problem went away when I deactivated W3 Total Cache. Will use a different caching method.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘call_user_func_array() expects parameter 1 to be a valid callback’ is closed to new replies.