So I have a page template that is setup as follows (using Kleo theme):
Search template
get_header(); ?>
<?php
//create right sidebar template
kleo_switch_layout('right');
?>
<?php get_template_part('page-parts/general-title-section'); ?>
<?php get_template_part('page-parts/general-before-wrap'); ?>
<?php
if ( have_posts() ) :
// Start the Loop.
while ( have_posts() ) : the_post(); ?>
<!-- Begin the Treeview menu -->
<form method="get" action="<?php bloginfo('url'); ?>">
<div class="form-group">
<input class="form-control" type="text" name="s" value="" placeholder="Search…" maxlength="50" required="required" />
</div>
<p>Refine search to posts containing chosen tags:</p>
<div class="acidjs-css3-treeview">
<ul>
<li><input type="checkbox" id="node-0" /><label><input type="checkbox" name="tag[]" value="node-0" /><span></span></label><label for="node-0">node-0</label>
<ul>
<li><input type="checkbox" id="node-0-0" /><label><input type="checkbox" name="tag[]" value="node-0-0" /><span></span></label><label for="node-0-0">node-0-0</label>
<ul>
<li><input type="checkbox" id="node-0-0-0" /><label><input type="checkbox" name="tag[]" value="node-0-0-0" /><span></span></label><label for="node-0-0-0">node-0-0-0</label></li>
<li><input type="checkbox" id="node-0-0-1" /><label><input type="checkbox" name="tag[]" value="node-0-0-1" /><span></span></label><label for="node-0-0-1">node-0-0-1</label></li>
</ul>
</li>
</ul>
</li>
<li><input type="checkbox" id="node-1" /><label><input type="checkbox" name="tag[]" value="node-1" /><span></span></label><label for="node-1">node-1</label>
<ul>
<li><input type="checkbox" id="node-1-0" /><label><input type="checkbox" name="tag[]" value="node-1-0" /><span></span></label><label for="node-1-0">node-1-0</label>
<ul>
<li><input type="checkbox" id="node-1-0-0" /><label><input type="checkbox" name="tag[]" value="node-1-0-0" /><span></span></label><label for="node-1-0-0">node-1-0-0</label></li>
<li><input type="checkbox" id="node-1-0-1" /><label><input type="checkbox" name="tag[]" value="node-1-0-1" /><span></span></label><label for="node-1-0-1">node-1-0-1</label></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<!-- End the Treeview menu -->
<input class="btn btn-primary" type="submit" value="Submit" />
</form>
<?php
/*
* Include the post format-specific template for the content. If you want to
* use this in a child theme, then include a file called called content-___.php
* (where ___ is the post format) and that will be used instead.
*/
get_template_part( 'content', 'page' );
?>
<?php get_template_part( 'page-parts/posts-social-share' ); ?>
<?php if ( sq_option( 'page_comments', 0 ) == 1 ): ?>
<!-- Begin Comments -->
<?php comments_template( '', true ); ?>
<!-- End Comments -->
<?php endif; ?>
<?php endwhile;
endif;
?>
<?php get_template_part('page-parts/general-after-wrap'); ?>
<?php get_footer(); ?>
Problem
The search is not functioning properly. It returns a query string as such:
The URL would show http://example.com/?s=searchterm&tag[]=key-word1&tag[]=key-word2
This would result in the tags not being filtered.
I can edit the [] out to make the tag search work, but then I would only be searching the last tag element in the GET, which defeats the purpose.
I was inspired to do this particular code for searching multiple tags on this question here. That link seems to suggest this won't work until WP 4.4 comes around. Any way of getting this working under current WP 4.3.1?