Title: Warning Error
Last modified: April 26, 2022

---

# Warning Error

 *  Resolved [jhayghost](https://wordpress.org/support/users/jhayghost/)
 * (@jhayghost)
 * [4 years, 3 months ago](https://wordpress.org/support/topic/warning-error-59/)
 * Just checking your plugin and I found this issue.
 * Warning: in_array() expects parameter 2 to be array, null given in wp-content/
   plugins/admin-search/settings.php on line 527

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

 *  [Maxime Freschard](https://wordpress.org/support/users/djsuperfive/)
 * (@djsuperfive)
 * [4 years, 3 months ago](https://wordpress.org/support/topic/warning-error-59/#post-15665752)
 * Same error here.
 *  [bkjproductions](https://wordpress.org/support/users/bkjproductions/)
 * (@bkjproductions)
 * [4 years, 2 months ago](https://wordpress.org/support/topic/warning-error-59/#post-15720973)
 * Same error here, though mine says Fatal, same line.
 * I tried using the **Troubleshooting Mode** to isolate it to just this one plugin,
   to make sure there were no other plugins interfering, and had the same problem.
 * While we _do _ have a few custom post types defined (okay, 18, but not my decision!)
   and a few custom taxonomies, those were not active during the Troubleshooting
   Mode, so it is something to do with line 527.
    `if ( in_array( $post_type -> 
   name, admin_search_setting( 'post_types' ) ) ) {`
 * So I changed it to this:
 *     ```
       if (is_array(admin_search_setting( 'post_types' ) ) ) {
       		if ( in_array( $post_type -> name, admin_search_setting( 'post_types' ) ) ) {
       				echo " checked";
       				}
       			}
       ```
   
 * I suspect that maybe the settings are not initialized yet, because by adding 
   an if/then wrapper to make sure the **admin_search_setting() **function _is _in
   fact an array, the error moves on down the line to #552
 * `PHP Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must
   be of type array, null given in /wp-content/plugins/admin-search/settings.php:
   552`
 * So, wrapping THAT error line with an if/then statement:
 *     ```
       if (is_array(admin_search_setting( 'taxonomies' ) ) ) {
   
       				if ( in_array( $taxonomy -> name, admin_search_setting( 'taxonomies' ) ) ) {
       					echo " checked";
       				}
       			}
       ```
   
 * So I think if you patch it up this way, it works.
 *  [Aris](https://wordpress.org/support/users/bugsysop/)
 * (@bugsysop)
 * [3 years, 9 months ago](https://wordpress.org/support/topic/warning-error-59/#post-16142712)
 * I have just tested these corrections in `settings.php` and they work like a charm.
   The plugin is now up and running. Thanks a lot.
    -  This reply was modified 3 years, 9 months ago by [Aris](https://wordpress.org/support/users/bugsysop/).
      Reason: typo
    -  This reply was modified 3 years, 9 months ago by [Aris](https://wordpress.org/support/users/bugsysop/).
 *  Plugin Author [Andrew Stichbury](https://wordpress.org/support/users/andrewstichbury/)
 * (@andrewstichbury)
 * [3 years, 9 months ago](https://wordpress.org/support/topic/warning-error-59/#post-16208449)
 * Hi jhayghost, Maxime, bkjproductions and Aris,
 * Thank you for your patience and solutions in the meantime. Version 1.2.2 resolves
   this issue.
 * Andrew

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

The topic ‘Warning Error’ is closed to new replies.

 * ![](https://ps.w.org/admin-search/assets/icon.svg?rev=3551847)
 * [Admin Search](https://wordpress.org/plugins/admin-search/)
 * [Support Threads](https://wordpress.org/support/plugin/admin-search/)
 * [Active Topics](https://wordpress.org/support/plugin/admin-search/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/admin-search/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/admin-search/reviews/)

 * 4 replies
 * 5 participants
 * Last reply from: [Andrew Stichbury](https://wordpress.org/support/users/andrewstichbury/)
 * Last activity: [3 years, 9 months ago](https://wordpress.org/support/topic/warning-error-59/#post-16208449)
 * Status: resolved