/?s=carpintero&zona=Berazategui
add_action( 'pre_get_posts', 'search_filter' ); function search_filter($query) { if ( !is_admin() && is_search() && $query->is_main_query() ) { if ( isset($_GET['zona']) && !empty($_GET['zona']) ){ //Get original meta query $meta_query = $query->get('meta_query'); //Add our meta query to the original meta queries $meta_query[] = array( 'key' => 'cp_zonas', 'value' => $_GET['zona'], 'compare' => '=' ); $query->set('meta_query',$meta_query); } } }
Array ( [s] => carpintero [error] => [m] => 0 [p] => 0 [post_parent] => [subpost] => [subpost_id] => [attachment] => [attachment_id] => 0 [name] => [static] => [pagename] => [page_id] => 0 [second] => [minute] => [hour] => [day] => 0 [monthnum] => 0 [year] => 0 [w] => 0 [category_name] => [tag] => [cat] => [tag_id] => [author_name] => [feed] => [tb] => [paged] => 0 [comments_popup] => [meta_key] => [meta_value] => [preview] => [sentence] => [fields] => [menu_order] => [category__in] => Array ( ) [category__not_in] => Array ( ) [category__and] => Array ( ) [post__in] => Array ( ) [post__not_in] => Array ( ) [tag__in] => Array ( ) [tag__not_in] => Array ( ) [tag__and] => Array ( ) [tag_slug__in] => Array ( ) [tag_slug__and] => Array ( ) [post_parent__in] => Array ( ) [post_parent__not_in] => Array ( ) [meta_query] => Array ( [0] => Array ( [key] => cp_zonas [value] => Berazategui [compare] => = ) ) [ignore_sticky_posts] => [suppress_filters] => [cache_results] => 1 [update_post_term_cache] => 1 [update_post_meta_cache] => 1 [post_type] => any [posts_per_page] => 7 [nopaging] => [comments_per_page] => 4 [no_found_rows] => [search_terms] => Array ( [0] => carpintero ) [order] => DESC )
There are currently 1 users browsing this thread. (0 members and 1 guests)