Title: Getting &quot;Warning: array_map(): Argument #2 should be in array
Last modified: August 30, 2016

---

# Getting "Warning: array_map(): Argument #2 should be in array

 *  Resolved [TMSpice](https://wordpress.org/support/users/tmspice/)
 * (@tmspice)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/getting-warning-array_map-argument-2-should-be-in-array/)
 * I did my WordPress update yesterday and since then I’ve been getting Warning:
   array_map(): Argument #2 should be in array in home/lifeand17public_html/wp-includes/
   category-templates.php on line 1158.
 * This appears on all posts when fully opened but not on my front page.
 * How do I resolve this, please?
 * And I’d like to add that since this appears to be a ‘mass’problem (I’ve read 
   other topics on this since yesterday), can this be a problem of the new WordPress
   4.4?

Viewing 15 replies - 1 through 15 (of 15 total)

 *  [Andrew Nevins](https://wordpress.org/support/users/anevins/)
 * (@anevins)
 * WCLDN 2018 Contributor | Volunteer support
 * [10 years, 5 months ago](https://wordpress.org/support/topic/getting-warning-array_map-argument-2-should-be-in-array/#post-6833731)
 * Have you read the 4.4 troubleshooting thread: [https://wordpress.org/support/topic/read-this-first-wordpress-44-master-list?replies=5&view=all](https://wordpress.org/support/topic/read-this-first-wordpress-44-master-list?replies=5&view=all)
 *  Thread Starter [TMSpice](https://wordpress.org/support/users/tmspice/)
 * (@tmspice)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/getting-warning-array_map-argument-2-should-be-in-array/#post-6833738)
 * Thanks Andrew, but I am confused as to what I should be looking out for on this
   long read. Is there a possibility of someone pin-pointing my actual problem and
   proffering a possible solution?
 * Thank you
 *  Moderator [Marius L. J.](https://wordpress.org/support/users/clorith/)
 * (@clorith)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/getting-warning-array_map-argument-2-should-be-in-array/#post-6833758)
 * Hi,
 * We just updated the thread to include this [https://wordpress.org/support/topic/read-this-first-wordpress-44-master-list?replies=6&view=all#post-7760865](https://wordpress.org/support/topic/read-this-first-wordpress-44-master-list?replies=6&view=all#post-7760865)
 * There’s a patch ready for 4.4.1 that should take care of that warning you are
   seeing in your logs.
 * As there is a ticket (and patch) for this ready, I’ll just tag this thread as
   resolved for now, it helps with keeping us sane after a major release 🙂
 *  [ronald.kubo](https://wordpress.org/support/users/ronaldkubo/)
 * (@ronaldkubo)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/getting-warning-array_map-argument-2-should-be-in-array/#post-6833807)
 * Had the same problem on one of my sites. As James Huff pointed on [WordPress 4.4 Master List](https://wordpress.org/support/topic/read-this-first-wordpress-44-master-list?replies=6)
   a few hours ago, a patch for this problem has been made as Marius mentioned above:
 * [https://core.trac.wordpress.org/attachment/ticket/34723/34723.patch](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 );
       ```
   
 * …with the 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
 *  [guitavares](https://wordpress.org/support/users/guitavares/)
 * (@guitavares)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/getting-warning-array_map-argument-2-should-be-in-array/#post-6833809)
 * Great, the patch above works just perfectly.
 * Thanks [@ronald](https://wordpress.org/support/users/ronald/).kubo!
 *  [mikon82](https://wordpress.org/support/users/mikon82/)
 * (@mikon82)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/getting-warning-array_map-argument-2-should-be-in-array/#post-6833863)
 * This patch does indeed work for our plugin, Foodpress, as well! thanks!
 *  [freddeume](https://wordpress.org/support/users/freddeume/)
 * (@freddeume)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/getting-warning-array_map-argument-2-should-be-in-array/#post-6833934)
 * I got the same problem with Event Manager.
 * But my function does not look exactly the same. Is it a problem?
 * 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 ); wp_cache_add($post->ID,
   $terms, $taxonomy . ‘_relationships’); }
 *  /**
    * Filter the list of terms attached to the given post. * * [@since](https://wordpress.org/support/users/since/)
   3.1.0 * * [@param](https://wordpress.org/support/users/param/) array|WP_Error
   $terms List of attached terms, or WP_Error on failure. * [@param](https://wordpress.org/support/users/param/)
   int $post_id Post ID. * [@param](https://wordpress.org/support/users/param/) 
   string $taxonomy Name of the taxonomy. */ $terms = apply_filters( ‘get_the_terms’,
   $terms, $post->ID, $taxonomy );
 *  if ( empty( $terms ) )
    return false;
 *  return $terms;
    }
 *  [freddeume](https://wordpress.org/support/users/freddeume/)
 * (@freddeume)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/getting-warning-array_map-argument-2-should-be-in-array/#post-6833940)
 * The fix work. My last post was a misstake. I logged in at an not upgraded site.
   Sorry.
 *  [croco2511](https://wordpress.org/support/users/croco2511/)
 * (@croco2511)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/getting-warning-array_map-argument-2-should-be-in-array/#post-6833962)
 * Is there a way to apply this patch by adding it in functions.php of the theme
   installed?
    One of the sites I maintain is unfortunately a GoDaddy hosted WordPress
   install so you can’t edit any core files.
 *  [TJ Kelly](https://wordpress.org/support/users/tjkelly/)
 * (@tjkelly)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/getting-warning-array_map-argument-2-should-be-in-array/#post-6833964)
 * Also, when can we expect to see 4.4.1?
 *  Moderator [Marius L. J.](https://wordpress.org/support/users/clorith/)
 * (@clorith)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/getting-warning-array_map-argument-2-should-be-in-array/#post-6833968)
 * [@croco2511](https://wordpress.org/support/users/croco2511/)
    Unfortunately not
   as it’s a non-pluggable core feature, although if you ask their support they 
   might be able to help you as it affects all their users so possibly something
   they’d be willing to consider applying.
 * [@tj](https://wordpress.org/support/users/tj/) Kelly
    It probably won’t land 
   until early January some time due to the holiday season being upon us and all,
   but we honestly can’t say when, it might be sooner, it might be later.
 *  [brycedmorgan](https://wordpress.org/support/users/brycedmorgan/)
 * (@brycedmorgan)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/getting-warning-array_map-argument-2-should-be-in-array/#post-6833987)
 * [@croco2511](https://wordpress.org/support/users/croco2511/),
 * I figured this out. This is the loophole to GoDaddy’s system:
    1. Download the entire folder wp-includes to your local machine
    2. Make the edit to category-template.php on your local machine (you should be 
       able to edit the permissions locally
    3. Via FTP, rename wp-includes on your server to something else (i.e. wp-includes-
       old)
    4. Upload your local copy of wp-includes to your server
    5. Flush the GoDaddy Cache
    6. Enjoy your website sans error
 * This worked perfectly for me.
 *  Moderator [Marius L. J.](https://wordpress.org/support/users/clorith/)
 * (@clorith)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/getting-warning-array_map-argument-2-should-be-in-array/#post-6833988)
 * [@brycedmorgan](https://wordpress.org/support/users/brycedmorgan/)
 * Unfortunately this won’t work if you use their managed WordPress hosting, as 
   you do not have FTP or file access there.
 * That being said, 4.4.1 is now in RC [https://make.wordpress.org/core/2016/01/05/4-4-1-release-candidate/](https://make.wordpress.org/core/2016/01/05/4-4-1-release-candidate/)
 *  [Haxn Rent a Car](https://wordpress.org/support/users/syedhasnain786/)
 * (@syedhasnain786)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/getting-warning-array_map-argument-2-should-be-in-array/#post-6834064)
 * Dear All Friends . i am facing the warning msgs on my wordpress website. i am
   not a professional web desighner but i want your help friends.
 * errors
 * Warning: in_array() expects parameter 2 to be array, null given in /home/zariyan4444/
   public_html/wp-includes/class.wp-dependencies.php on line 344
 * Warning: Invalid argument supplied for foreach() in /home/zariyan4444/public_html/
   wp-includes/class.wp-dependencies.php on line 339
 * Warning: in_array() expects parameter 2 to be array, null given in /home/zariyan4444/
   public_html/wp-includes/class.wp-dependencies.php on line 344
 * Warning: Invalid argument supplied for foreach() in /home/zariyan4444/public_html/
   wp-includes/class.wp-dependencies.php on line 339
 * Warning: in_array() expects parameter 2 to be array, null given in /home/zariyan4444/
   public_html/wp-includes/class.wp-dependencies.php on line 344
 * Warning: Invalid argument supplied for foreach() in /home/zariyan4444/public_html/
   wp-includes/class.wp-dependencies.php on line 339
 * Warning: in_array() expects parameter 2 to be array, null given in /home/zariyan4444/
   public_html/wp-includes/class.wp-dependencies.php on line 344
 * Warning: Invalid argument supplied for foreach() in /home/zariyan4444/public_html/
   wp-includes/class.wp-dependencies.php on line 339
 * please help to sort out. [my website ](http://www.hiremanwithvanlondon.com)
 *  [Andrew Nevins](https://wordpress.org/support/users/anevins/)
 * (@anevins)
 * WCLDN 2018 Contributor | Volunteer support
 * [10 years, 1 month ago](https://wordpress.org/support/topic/getting-warning-array_map-argument-2-should-be-in-array/#post-6834065)
 * [@syedhasnain786](https://wordpress.org/support/users/syedhasnain786/), You’re
   not facing the same issue. Please open a new thread: [https://wordpress.org/support/forum/how-to-and-troubleshooting#postform](https://wordpress.org/support/forum/how-to-and-troubleshooting#postform)

Viewing 15 replies - 1 through 15 (of 15 total)

The topic ‘Getting "Warning: array_map(): Argument #2 should be in array’ is closed
to new replies.

## Tags

 * [array](https://wordpress.org/support/topic-tag/array/)
 * [category](https://wordpress.org/support/topic-tag/category/)
 * [template](https://wordpress.org/support/topic-tag/template/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 15 replies
 * 11 participants
 * Last reply from: [Andrew Nevins](https://wordpress.org/support/users/anevins/)
 * Last activity: [10 years, 1 month ago](https://wordpress.org/support/topic/getting-warning-array_map-argument-2-should-be-in-array/#post-6834065)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
