search custom fields
-
Hello,
I am hoping to use Custom Post Type and Custom feilds to create a GEO postal code search.I have already unserialized my wordpress build. I am trying to test my search now and i ignores my custom field search.
It is ignoring ‘region’ => $newcamps_region and dumping 10 results
region is the custom fieldHow would I write this query?
$postal_code = $_POST[“postal_code”];
$distance = $_POST[“distance”];
$newcamps_region = $_POST[“newcamps_region”];echo “Postal Code: “.$postal_code.”
“;
echo “Distance: “.$distance.”
“;
echo “Region: “.$newcamps_region.”
“;$args = array( ‘post_type’ => ‘NEW Camp’, ‘posts_per_page’ => 10, ‘region’ => $newcamps_region );
$loop = new WP_Query( $args );if ( $loop->have_posts() ) :
while ( $loop->have_posts() ) : $loop->the_post();
the_title();
echo ‘<div class=”entry-content”>’;
the_content();
echo ‘</div>’;
endwhile;else:
echo ‘no results found’;
endif;
https://ww.wp.xz.cn/plugins/wck-custom-fields-and-custom-post-types-creator/
The topic ‘search custom fields’ is closed to new replies.