Warning: array_map(): Argument #2 should be an array … /wp-includes/category-template.php on line 1158

Since upgrading to WordPress 4.4 I had some sites’ post archives display with the following error –

'Warning: array_map(): Argument #2 should be an array in /home/.../public_html/wp-includes/category-template.php on line 1158'

This seems to be an issue with WordPress’ function get_the terms and the argument $items referenced as an array, and will be addressed in the next update – 4.4.1.

In the meantime you can add the patch yourself to the category-template.php in the wp-includes directory replacing the get_the_terms function.

10 Comments

  1. Oliver on January 1, 2016 at 4:31 pm

    I tried this patch as I was having issues retrieving a custom taxonomy, after applying tis patch it appears to mess around with the standard post categories, they disappeared form the posts admin screen and the frontend (but were still there). Reverting and they came back again

  2. Melissa Fox-Austin on December 31, 2015 at 11:16 pm

    Thank you!

  3. indianaG on December 30, 2015 at 12:37 pm

    Thanks Neil !!! ;-)

  4. Blade on December 24, 2015 at 6:56 pm

    Cool :D

  5. aurora on December 20, 2015 at 1:48 am

    so i don’t have a category-template.php, any ideas where i should put this? i did not notice any similar coding in my css stylesheet which was my guess.

    • Neil Gee on December 20, 2015 at 4:18 am

      The change is not in your theme files it is in WordPress core /wp-includes/category-template.php

  6. michi on December 17, 2015 at 5:40 pm

    Thanks a lot ! Saved my day :)

  7. Jill on December 15, 2015 at 11:16 am

    Thank you!!! Your fix fixed it ;)

  8. Avinash Kabra on December 14, 2015 at 12:42 pm

    Thank you so much for the fix.

    • Brian on December 29, 2015 at 7:05 pm

      Life saver. Updated WordPress and it gave me this error. This fixed it. Thank you!

Leave all Comment