Title: [Plugin: More Types] Warning: in_array() expects parameter 2 to be array
Last modified: August 19, 2016

---

# [Plugin: More Types] Warning: in_array() expects parameter 2 to be array

 *  [ra-Vincent](https://wordpress.org/support/users/ra-vincent/)
 * (@ra-vincent)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/plugin-more-types-warning-in_array-expects-parameter-2-to-be-array/)
 * With the more types plugin i have a problem with a warning message from php
 * When i openup the more types plugin and try to create or modify a custom posttype
   i get the following error:
 * > Warning: in_array() expects parameter 2 to be array, string given in wp-content/
   > plugins/more-types/more-types-settings.php on line 291
 * The easiest way to solve this, is by editing more-types-settings.php and go to
   this part around line 291
 *     ```
       $tax = array();
       $stax = array();
       $mytax[] = $more_types_settings->get_val('taxonomies');
       	foreach($wp_taxonomies as $taxonomy) {
       		if (!trim($taxonomy->label)) continue;
       		$tax[$taxonomy->name] = $taxonomy->label;
       		if (in_array($taxonomy->name, $mytax)) $stax[] = $taxonomy;
       	}
       ```
   
 * at line:
 *     ```
       if (in_array($taxonomy->name, $mytax)) $stax[] = $taxonomy;
       ```
   
 * it fails
    `in_array($taxonomy->name, $mytax)` $mytax is not an array but code
   says it is (see the []): `$mytax[] = $more_types_settings->get_val('taxonomies');`
   However, some php configurations do not understand that for a unknown reason,
   i think.
 * So the easiest way is to add up:
    `$mytax = array();` above `$mytax[] = $more_types_settings-
   >get_val('taxonomies');` so we get:
 *     ```
       $tax = array();
       $stax = array();
       $mytax = array();
       $mytax[] = $more_types_settings->get_val('taxonomies');
       	foreach($wp_taxonomies as $taxonomy) {
       		if (!trim($taxonomy->label)) continue;
       		$tax[$taxonomy->name] = $taxonomy->label;
       		if (in_array($taxonomy->name, $mytax)) $stax[] = $taxonomy;
       	}
       ```
   
 * It is a easy and quick fix, but when more types gets updated, the $mytax array
   will not be present and will probally cause the same warning message.
 * Could this simple fix be added in the upcoming release?
 * An another fix is probally,** but is not tested **by adding up
    `$mytax = array();`
   in the functions.php of your theme, with that setting it is possible the error
   disappears too and you can update more types without problems.
 * Request is to add up that line in de next release, is that possible?
    This problem
   has been appeared by two WordPress installations which are managed by me.

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

 *  [DanClarkePro](https://wordpress.org/support/users/danclarkepro/)
 * (@danclarkepro)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/plugin-more-types-warning-in_array-expects-parameter-2-to-be-array/#post-1996778)
 * You could also say that if it is empty, make it an empty array. Because if it
   is not empty then it will be an array anyway.
 * `if(empty($mytax)) { $mytax = array(); }`
 *  [jepotski](https://wordpress.org/support/users/jepotski/)
 * (@jepotski)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/plugin-more-types-warning-in_array-expects-parameter-2-to-be-array/#post-1996857)
 * it should be put after and not before the line:
 * `$mytax = $more_types_settings->get_val('taxonomies');`
 * to make it like this:
 *     ```
       $mytax = $more_types_settings->get_val('taxonomies');
       if(!is_array($mytax)) { $mytax = array(); }
       ```
   

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

The topic ‘[Plugin: More Types] Warning: in_array() expects parameter 2 to be array’
is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/more-types.svg)
 * [More Types](https://wordpress.org/plugins/more-types/)
 * [Support Threads](https://wordpress.org/support/plugin/more-types/)
 * [Active Topics](https://wordpress.org/support/plugin/more-types/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/more-types/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/more-types/reviews/)

 * 2 replies
 * 3 participants
 * Last reply from: [jepotski](https://wordpress.org/support/users/jepotski/)
 * Last activity: [15 years, 2 months ago](https://wordpress.org/support/topic/plugin-more-types-warning-in_array-expects-parameter-2-to-be-array/#post-1996857)
 * Status: not resolved