Support

Account

Home Forums General Issues Select posts for loop based on whether an array contains value or not Reply To: Select posts for loop based on whether an array contains value or not

  • Hi,

    Try this:

    
    global $post;
    	$current_page = $post->ID;
    	$int = (int)$current_page;
    	$string_page = (string)$current_page;
    	$current_parent_page = $mv_is_subpage->ID;
    	
    	// Post selection
    	
    	$args = array (
    		'post_type'      => $post_type,
    		'posts_per_page' => $posts_per_page,
    		'orderby'        => $orderby, 
    		'order'          => $order,
    		'no_found_rows'  => 1,
    //		'category_name' => 'test'
    		'meta_query' => array( 
    			array(
    				'key' => 'assigned_page', 
    				'value' => "$string_page",
    				'compare' => 'LIKE' 
    			)
    		),
    	);
    

    Also you have some strange parameters such as “no_found_rows” and “category_name” which does not exist in the wp_query class.. These should probably be removed if you dont know what you’re doing with them.. And make sure that your variables such as $order etc. is set!