• Resolved Aris

    (@bugsysop)


    WordPress 6.0.1 with PHP 7.3.5
    Using Site Search Version 1.2.0

    For every Post Type setting I have this error message

    
    Warning: in_array() expects parameter 2 to be array, null given in /home/johndoe/Local Sites/mysite/app/public/wp-content/plugins/admin-search/settings.php on line 527
    
Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter Aris

    (@bugsysop)

    The function that generete the error (setting.php file from the plugin)

    function admin_search_setting_post_types() {
    
    	echo "<div id='admin_search_plugin_setting_post_types'>";
    
    	foreach ( get_post_types( array(), 'object' ) as $post_type ) {
    		if ( $post_type -> {'public'} ) {
    			echo "<p><label><input type='checkbox' name='admin_search_settings[post_types][]' value='{$post_type -> name}'";
    
    			if ( in_array( $post_type -> name, admin_search_setting( 'post_types' ) ) ) {
    				echo " checked";
    			}
    
    			echo "> {$post_type -> label}</label></p>";
    		}
    	}
    
    	echo "</div>";
    
    }

    This may have something to do with this…

    The error message is pretty clear: the in_array() function expects the second parameter to be an array. Instead, it’s receiving a string from that code snippet. If you’re the developer of this plugin you need to add some extra validations to prevent this issue from happening.

    From Stackoverflow

    Thread Starter Aris

    (@bugsysop)

    Solution is here

    Plugin Author Andrew Stichbury

    (@andrewstichbury)

    Hi Aris,

    Apologies for not responding sooner. Version 1.2.2 should resolve this issue.

    Andrew

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Errors messages in settings page’ is closed to new replies.