Title: search custom fields
Last modified: August 31, 2016

---

# search custom fields

 *  Resolved [justinblayney](https://wordpress.org/support/users/justinblayney/)
 * (@justinblayney)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/search-custom-fields-3/)
 * 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 field
 * How 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://wordpress.org/plugins/wck-custom-fields-and-custom-post-types-creator/](https://wordpress.org/plugins/wck-custom-fields-and-custom-post-types-creator/)

The topic ‘search custom fields’ is closed to new replies.

 * ![](https://ps.w.org/wck-custom-fields-and-custom-post-types-creator/assets/icon-
   256x256.png?rev=2257602)
 * [Custom Post Types and Custom Fields creator - WCK](https://wordpress.org/plugins/wck-custom-fields-and-custom-post-types-creator/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wck-custom-fields-and-custom-post-types-creator/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wck-custom-fields-and-custom-post-types-creator/)
 * [Active Topics](https://wordpress.org/support/plugin/wck-custom-fields-and-custom-post-types-creator/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wck-custom-fields-and-custom-post-types-creator/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wck-custom-fields-and-custom-post-types-creator/reviews/)

## Tags

 * [custom fields](https://wordpress.org/support/topic-tag/custom-fields/)
 * [query](https://wordpress.org/support/topic-tag/query/)

 * 0 replies
 * 1 participant
 * Last reply from: [justinblayney](https://wordpress.org/support/users/justinblayney/)
 * Last activity: [10 years, 4 months ago](https://wordpress.org/support/topic/search-custom-fields-3/)
 * Status: resolved