Two Search pages, One search form

Hook into ‘template_include’ and change the template here. Made up example, not tested: add_action( ‘template_include’, ‘wpse_96472_search_template’ ); function wpse_96472_search_template( $template ) { if ( ! is_search() ) return $template; if ( empty ( $_GET[‘post_type’] ) ) return $template; if ( ‘poster’ === $_GET[‘post_type’] ) return get_template_directory() . ‘/poster-search-template.php’; if ( ‘house’ === $_GET[‘post_type’] ) return … Read more

Private Posts/Pages & Search

This is the default WordPress behavior. http://codex.wordpress.org/Content_Visibility#Private_Content Private posts are automatically published but not visible to anyone but those with the appropriate permission levels (Editor or Administrator). WARNING: If your site has multiple editors or administrators, they will be able to see your protected and private posts in the Edit panel. If you want to … Read more

WooCommerce product search titles only

This is an 9 months question, but since I had the same issue and found a solution, I came here to post it. On file wp-content/plugins/woocommerce/classes/class-wc-query.php, function pre_get_posts( $q ), WooCommerce defines at line 114: add_filter( ‘posts_where’, array( $this, ‘search_post_excerpt’ ) ); This is the point when WooCommerce mess up your query! The function search_post_excerpt … Read more

esc_url returns incorrect URL

It ended up being something very easy, but something I overlooked. Since I always use <?php get_search_form(); ?> for my search forms, I naturally assume that in my section template for the search area, I was using that, but I was not. I built the theme custom off of another theme I built for a … Read more

Why won’t is_search work inside functions.php?

… the call works fine as it actually echos “nope” where it’s supposed to, are you saying that it may be a problem because I’m making an ajax call which is not search.php? An Ajax call is a new request to the server. The page that loads is (should be) wp-admin/admin-ajax.php which is template neutral. … Read more

have_posts() execution failure

Your problem is the weird code at the top of the page. To understand what’s happening let me state a standard loop in pseudocode: if we still have posts to process while we still have posts to process mark this post as processed and move to the next one do things with it ( like … Read more