• Hi guys is a while since I’m stuck on this thing and I can not see where the problem is ..
    the function has to give me as a result of all the articles that are in the category x, y and custom taxonomy (if y has subcategories should also search in subcategories), and have the meta key price between a and b

    this is the code I used

    $regione=isset($_GET["reg"]) ? filter_var($_GET["reg"], FILTER_SANITIZE_STRING) : 0;
    	$provincia=isset($_GET["prov"]) ? filter_var($_GET["prov"], FILTER_SANITIZE_STRING) : 0;
    	$cittaa=isset($_GET["cit"]) ? filter_var($_GET["cit"], FILTER_SANITIZE_STRING) : 0;
    
    	$citta=$cittaa;
    	if (!$cittaa){$citta=$provincia;}
    	if (!$provincia && !$cittaa){ $citta=$regione;}
    
    	$pmin=isset($_GET["pmin"]) ? filter_var($_GET["pmin"], FILTER_SANITIZE_STRING) : 0;
    	$pmax=isset($_GET["pmax"]) ? filter_var($_GET["pmax"], FILTER_SANITIZE_STRING) : 99999999999;
    	$categoria=isset($_GET["cat"]) ? filter_var($_GET["cat"], FILTER_SANITIZE_STRING) : 0;
    
    	$args = array(
    		'post_type'        => 'post',
    		'post_status'      => 'publish',
    		/*'posts_per_page'   => 6,*/
    		'category' 		   => $categoria,
    		'tax_query' => array(
    			array(
    				'taxonomy' => 'location',
    				'field' => 'id',
    				'terms' => $citta
    			)
    		),
    		'meta_query'       => array(
    			array(
    				'key' => 'prezzo',
    				'value' => array( $pmin, $pmax ),
    				'type' => 'numeric',
    				'compare' => 'BETWEEN'
    			)
    		)
    	);
    	//print_r(array_values($args));
    	$posts=get_posts( $args );

    this is the link gustadare.it/locali
    the offending box is on the right of the page

    I can not see the problem …

  • The topic ‘get_posts error’ is closed to new replies.