Support » Fixing WordPress » ERROR: Warning: call_user_func_array() expects parameter 1 to be a valid callbac

  • I am using a very old theme on one of my wordpress websites (murdock), which no longer has any support. I am getting the following error on my website, at the top of all pages:

    Warning: call_user_func_array() expects parameter 1 to be a valid callback, function ‘greenday_head’ not found or invalid function name in /home/xnvrtebr/public_html/Blog/wp-includes/class-wp-hook.php on line 286

    You cannot see the error on the wesite as it is black text on a black background. But you can if you highlight what is on the page with the mouse.

    I am not a programmer/developer so I do not know how to fix this issue all by myself. Coding is beyond my skill level. Modifying existing code can be done (if someone shows me what to do or how to fix it). I can locate files & edit them.

    Here is the code in class-wp-hook.php around line 286

    /**
    	 * Calls the callback functions added to a filter hook.
    	 *
    	 * @since 4.7.0
    	 *
    	 * @param mixed $value The value to filter.
    	 * @param array $args  Arguments to pass to callbacks.
    	 * @return mixed The filtered value after all hooked functions are applied to it.
    	 */
    	public function apply_filters( $value, $args ) {
    		if ( ! $this->callbacks ) {
    			return $value;
    		}
    
    		$nesting_level = $this->nesting_level++;
    
    		$this->iterations[ $nesting_level ] = array_keys( $this->callbacks );
    		$num_args = count( $args );
    
    		do {
    			$this->current_priority[ $nesting_level ] = $priority = current( $this->iterations[ $nesting_level ] );
    
    			foreach ( $this->callbacks[ $priority ] as $the_ ) {
    				if( ! $this->doing_action ) {
    					$args[ 0 ] = $value;
    				}
    
    				// Avoid the array_slice if possible.
    				if ( $the_['accepted_args'] == 0 ) {
    					$value = call_user_func_array( $the_['function'], array() );
    				} elseif ( $the_['accepted_args'] >= $num_args ) {
    					$value = call_user_func_array( $the_['function'], $args );
    				} else {
    					$value = call_user_func_array( $the_['function'], array_slice( $args, 0, (int)$the_['accepted_args'] ) );
    				}
    			}
    		} while ( false !== next( $this->iterations[ $nesting_level ] ) );
    
    		unset( $this->iterations[ $nesting_level ] );
    		unset( $this->current_priority[ $nesting_level ] );
    
    		$this->nesting_level--;
    
    		return $value;
    	}

    Line 286 is this bit:

    $value = call_user_func_array( $the_['function'], $args );

    Can someone who is cleverer than me please help me with this? Anyone?

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Moderator Marius L. J.

    (@clorith)

    Hi,

    This is likely not the code where the problem lies (this is part of the WordPress core code), but more likely in a plugin or theme trying to use a feature the wrong way. Would you be able to check if you have any logs that include more than this, it’s generally around 10 lines for such warnings, and would help pinpoint where the problem actually lies.

    from various directories:

    
    [22-Oct-2017 02:54:08 UTC] PHP Fatal error:  Call to undefined function _deprecated_file() in /home/xnvrtebr/public_html/Blog/wp-includes/registration-functions.php on line 7
    [03-Jan-2018 20:38:07 UTC] PHP Fatal error:  Call to undefined function get_header() in /home/xnvrtebr/public_html/Blog/wp-content/themes/murdock-10/404.php on line 1
    [09-Jan-2018 21:23:38 UTC] PHP Fatal error:  Call to undefined function get_header() in /home/xnvrtebr/public_html/Blog/wp-content/themes/murdock-10/404.php on line 1
    [25-Jan-2018 15:09:26 UTC] PHP Fatal error:  Call to undefined function get_header() in /home/xnvrtebr/public_html/Blog/wp-content/themes/murdock-10/404.php on line 1
    [01-Feb-2018 11:20:15 UTC] PHP Fatal error:  Call to undefined function get_header() in /home/xnvrtebr/public_html/Blog/wp-content/themes/murdock-10/404.php on line 1
    [01-Feb-2018 16:18:05 UTC] PHP Fatal error:  Call to undefined function get_header() in /home/xnvrtebr/public_html/Blog/wp-content/themes/murdock-10/404.php on line 1
    [07-Mar-2018 04:26:54 UTC] PHP Fatal error:  Call to undefined function get_header() in /home/xnvrtebr/public_html/Blog/wp-content/themes/murdock-10/archive.php on line 1
    [15-Mar-2018 08:47:23 UTC] PHP Fatal error:  Call to undefined function wp_title() in /home/xnvrtebr/public_html/Blog/wp-content/themes/murdock-10/header.php on line 3
    [15-Mar-2018 11:52:19 UTC] PHP Fatal error:  Call to undefined function get_header() in /home/xnvrtebr/public_html/Blog/wp-content/themes/murdock-10/archive.php on line 1
    [15-Mar-2018 11:52:20 UTC] PHP Fatal error:  Call to undefined function get_header() in /home/xnvrtebr/public_html/Blog/wp-content/themes/murdock-10/archive.php on line 1
    [16-Mar-2018 04:18:37 UTC] PHP Fatal error:  Call to undefined function get_header() in /home/xnvrtebr/public_html/Blog/wp-content/themes/murdock-10/404.php on line 1
    [20-Mar-2018 15:48:17 UTC] PHP Fatal error:  Call to undefined function get_header() in /home/xnvrtebr/public_html/Blog/wp-content/themes/murdock-10/archive.php on line 1
    [21-Mar-2018 09:07:00 UTC] PHP Fatal error:  Call to undefined function wp_title() in /home/xnvrtebr/public_html/Blog/wp-content/themes/murdock-10/header.php on line 3
    [21-Mar-2018 09:07:07 UTC] PHP Fatal error:  Call to undefined function wp_title() in /home/xnvrtebr/public_html/Blog/wp-content/themes/murdock-10/header.php on line 3
    [28-Mar-2018 01:40:46 UTC] PHP Fatal error:  Call to undefined function wp_title() in /home/xnvrtebr/public_html/Blog/wp-content/themes/murdock-10/header.php on line 3
    [29-Mar-2018 06:39:53 UTC] PHP Fatal error:  Call to undefined function get_header() in /home/xnvrtebr/public_html/Blog/wp-content/themes/murdock-10/index.php on line 1
    [06-Apr-2018 11:24:07 UTC] PHP Fatal error:  Call to undefined function get_header() in /home/xnvrtebr/public_html/Blog/wp-content/themes/murdock-10/404.php on line 1
    [07-Apr-2018 05:30:53 UTC] PHP Fatal error:  Call to undefined function get_header() in /home/xnvrtebr/public_html/Blog/wp-content/themes/murdock-10/archive.php on line 1
    [08-Apr-2018 16:59:16 UTC] PHP Fatal error:  Call to undefined function get_header() in /home/xnvrtebr/public_html/Blog/wp-content/themes/murdock-10/404.php on line 1
    [12-Apr-2018 22:09:41 UTC] PHP Fatal error:  Call to undefined function get_header() in /home/xnvrtebr/public_html/Blog/wp-content/themes/murdock-10/archive.php on line 1
    [08-Jul-2018 20:41:21 UTC] PHP Fatal error:  Call to undefined function get_header() in /home/xnvrtebr/public_html/Blog/wp-content/themes/murdock-10/index.php on line 1
    [30-Jul-2018 23:52:42 UTC] PHP Fatal error:  Call to undefined function get_header() in /home/xnvrtebr/public_html/Blog/wp-content/themes/murdock-10/archive.php on line 1
    [30-Jul-2018 23:52:42 UTC] PHP Fatal error:  Call to undefined function get_header() in /home/xnvrtebr/public_html/Blog/wp-content/themes/murdock-10/index.php on line 1
    [30-Jul-2018 23:52:43 UTC] PHP Fatal error:  Call to undefined function get_header() in /home/xnvrtebr/public_html/Blog/wp-content/themes/murdock-10/404.php on line 1
    [16-Aug-2018 16:41:43 UTC] PHP Fatal error:  Call to undefined function get_header() in /home/xnvrtebr/public_html/Blog/wp-content/themes/murdock-10/index.php on line 1
    [16-Aug-2018 16:41:43 UTC] PHP Fatal error:  Call to undefined function wp_title() in /home/xnvrtebr/public_html/Blog/wp-content/themes/murdock-10/header.php on line 3
    [16-Aug-2018 16:41:43 UTC] PHP Fatal error:  Call to undefined function get_header() in /home/xnvrtebr/public_html/Blog/wp-content/themes/murdock-10/archive.php on line 1
    [16-Aug-2018 16:41:43 UTC] PHP Fatal error:  Call to undefined function get_header() in /home/xnvrtebr/public_html/Blog/wp-content/themes/murdock-10/404.php on line 1
    [23-Aug-2018 03:31:39 UTC] PHP Fatal error:  Call to undefined function get_header() in /home/xnvrtebr/public_html/Blog/wp-content/themes/murdock-10/index.php on line 1
    [23-Aug-2018 03:31:39 UTC] PHP Fatal error:  Call to undefined function get_header() in /home/xnvrtebr/public_html/Blog/wp-content/themes/murdock-10/archive.php on line 1
    [23-Aug-2018 03:31:39 UTC] PHP Fatal error:  Call to undefined function wp_title() in /home/xnvrtebr/public_html/Blog/wp-content/themes/murdock-10/header.php on line 3
    [23-Aug-2018 03:31:39 UTC] PHP Fatal error:  Call to undefined function get_header() in /home/xnvrtebr/public_html/Blog/wp-content/themes/murdock-10/404.php on line 1
    [04-Dec-2018 02:35:42 UTC] PHP Warning:  call_user_func_array() expects parameter 1 to be a valid callback, function 'greenday_head' not found or invalid function name in /home/xnvrtebr/public_html/Blog/wp-includes/class-wp-hook.php on line 286
    
    [07-Dec-2018 02:02:46 UTC] PHP Deprecated:  Automatically populating $HTTP_RAW_POST_DATA is deprecated and will be removed in a future version. To avoid this warning set 'always_populate_raw_post_data' to '-1' in php.ini and use the php://input stream instead. in Unknown on line 0

    Line one is always:

    <?php get_header(); ?>

    Line three is:

    <meta charset="UTF-8">

    Line seven is:

    
    _deprecated_file( basename(__FILE__), '2.1.0', null, __( 'This file no longer needs to be included.' ) );
    Moderator Marius L. J.

    (@clorith)

    Hiya,

    That looks like it’s part of a specific file in your theme, I would love to know what the content of your sites error log file is (if your host has a control panel of some kind, it usually has a button dedicated to displaying this error log), do you happen to have access to something like that?

    I do. (I think)
    Late here, 3:00am.
    Will do tomorrow.

    I had the same thing happen to me late yesterday.

    One of my plugins was messed up and social media icons weren’t displaying properly.
    I deactivated the plugin and because I was thinking I no longer needed it, I decided I would no longer use Font Awesome.

    I edited a function in functions.php in my child theme but forgot to remove the add_action line. Because part of the code remained, I had a glaring PHP error very similar to yours.

    In my case I had removed a function that enqueued Font Awesome. The original function looked something like this:

    https://www.elegantthemes.com/blog/tips-tricks/font-awesome-wordpress

    So check your child theme, if you have one. Maybe something similar is going on for you.

Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.