• Resolved jhayghost

    (@jhayghost)


    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)
  • Same error here.

    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

    (@bugsysop)

    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 2 years ago by Aris. Reason: typo
    • This reply was modified 2 years ago by Aris.
    Plugin Author Andrew Stichbury

    (@andrewstichbury)

    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.