Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have created a custom post type named archive with its own search filter, powered by:

    <form class="searchformcustom" action="<?php echo home_url( '/' ); ?>" method="get">
    <input class="second" name="s" type="text" value="" placeholder="SEARCH..." />
    <input name="post_type" type="hidden" value="archive"  />

This is what my search.php looks like:

global $wp_query;
$total_results = $wp_query->found_posts;

if(!$wp_query) global $wp_query;
query_posts( array_merge( array( 'category__not_in' => array() ) , $wp_query->query ) );

$search_refer = $_GET["post_type"];
if ($search_refer == 'archive') { load_template(TEMPLATEPATH . '/search-gallery.php'); }
else{load_template(TEMPLATEPATH . '/search-standard.php');}

One search form searches through the custom post type only, and the other searches the rest of the site. I have added a meta box for the custom post type, but when i search any content that i've added through the meta box, nothing comes up. How do i include meta box data within my search results?

share|improve this question
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.