This thread is over two years old and may be outdated. Please create a new thread if you need help, or email us if you have an active Premium license.

Warning after the upgrade to WP 4.4

Open 4 replies generaltechnical
10 years ago · Last reply by rpf 10 years ago

Just upgraded wordpress to 4.4 and new seeing this error:
Warning: array_map(): Argument #2 should be an array in /home/…/wp-includes/category-template.php on line 1158

The google tells me this is a common error this morning, and that it is a theme incompatibility (especially or only if woocommerce is installed?) I’m using Vantage, but many themes from many developers seem to be having the error.

Any advice?

This is our free support forum. Replies can take several days.

Need fast email support? Get SiteOrigin Premium

Replies

4
  1. Greg Priday Staff 10 years, 2 months ago

    Hi Rpf

    It’s possible this is some sort of isssue in WordPress itself. You can try switching to a default WordPress theme like Twenty Fifteen to see if it fixes the issue. This will help diagnose if it’s Vantage related.

  2. Ronald Postma 10 years, 2 months ago

    Had the same problem on one of my sites. As James Huff pointed on WordPress 4.4 Master List a few hours ago, a patch for this problem has been made:

    https://core.trac.wordpress.org/attachment/ticket/34723/34723.patch

    To fix, open your category-template.php and replace lines 1144 – 1158…

    function get_the_terms( $post, $taxonomy ) {
    	if ( ! $post = get_post( $post ) )
    		return false;
    	$terms = get_object_term_cache( $post->ID, $taxonomy );
    	if ( false === $terms ) {
    		$terms = wp_get_object_terms( $post->ID, $taxonomy );
    		$to_cache = array();
    		foreach ( $terms as $key => $term ) {
    			$to_cache[ $key ] = $term->data;
    		}
    		wp_cache_add( $post->ID, $to_cache, $taxonomy . '_relationships' );
    	}
    	$terms = array_map( 'get_term', $terms );

    New code from the patch:

    function get_the_terms( $post, $taxonomy ) {
    	if ( ! $post = get_post( $post ) )
    		return false;
    	$terms = get_object_term_cache( $post->ID, $taxonomy );
     	if ( false === $terms ) {
     		$terms = wp_get_object_terms( $post->ID, $taxonomy );
    		if ( ! is_wp_error( $terms ) ) {
    			$to_cache = array();
    			foreach ( $terms as $key => $term ) {
    				$to_cache[ $key ] = $term->data;
    			}
    			wp_cache_add( $post->ID, $to_cache, $taxonomy . '_relationships' );
     		}
     	}
    	if ( ! is_wp_error( $terms ) ) {
    		$terms = array_map( 'get_term', $terms );
    	}

    So is now line 1144 – 1162. This fix will be included in the future 4.4.1 I suppose

  3. Greg Priday Staff 10 years, 2 months ago

    Thanks very much for the solution Ronald. I’ll also be sure to add post editing in the next update to our forum system :)

  4. rpf 10 years, 2 months ago

    Thanks Ronald & Greg. I applied the patch and now see the error less often, but it’s not entirely gone. I used to see the same error repeated 5 times at the top of the page, and now it appears only once, on those infrequent occasions it shows up at all. I’m not too worried about it, maybe a future update will take care of it.

Replies on this thread are closed.

Please create a new thread if you have a question, or purchase a SiteOrigin Premium license if you need one-on-one email support.

Have a different question or issue?

Start New Thread