TL;DR (but please read): custom taxonomy values are not being pulled from the post, except for sometimes.
I have a Custom Post Type: vehicles. I created two custom taxonomies just for that CPT: vehicle_make and vehicle_model. These were done use the CPT UI plugin. There are various other ACF fields as well.
The search form is setup like so:
Make | Model | Year | Location | Reset
You can see the dev version here:
http://tap.voltaic.xyz/inventory/
I’m displaying the results using a custom template (600.php):
<?php if ( $query->have_posts() )
{
?>
<div class="inv_container">
<p class="inv_count">Found <?php echo $query->found_posts; ?> Vehicles</p>
<p class="inv_note">You can bookmark and share these results.</p>
<div class="inv_header clear">
<div class="inv_make">Make</div>
<div class="inv_model">Model</div>
<div class="inv_year">Year</div>
<div class="inv_location">Location</div>
<div class="inv_row">Row</div>
</div>
<?php while ($query->have_posts()) { $query->the_post(); ?>
<?php
$classes = array();
$classes[] = "inv_item";
$classes[] = "clear";
?>
<article <?php post_class($classes); ?> >
<div class="inv_make"><?php echo get_field('v_make')->name; ?></div>
<div class="inv_model"><?php echo get_field('v_model')->name; ?></div>
<div class="inv_year"><?php the_field('year'); ?></div>
<div class="inv_location"><?php the_field('city'); ?></div>
<div class="inv_row"><?php the_field('row'); ?></div>
</article>
<?php } ?>
</div>
<?php
}
else
{
echo "No Results Found";
}
?>
When you visit the dev site you’ll see that I’m receiving a PHP error because the custom taxonomy values are not being pulled from the post. However, if you look at this custom search you’ll notice that one of the results is showing as intended:
http://tap.voltaic.xyz/inventory/?_sft_vehicle_make=honda&_sft_vehicle_model=civic&_sfm_year=1999
I added about 1800 posts to this CPT using WP Ultimate CSV Importer. When I edit one of these posts, from the import, the custom taxonomies show up on the edit screen, selected as they are expected to be (I also imported a sampling of posts using another CSV importer and it had the same results). Now, here’s the interesting part, if I update one of the posts, from the import, it will show up as expected in the results (I just edit the post and immediately click Update, nothing else). The Honda Civic from that custom search is one such post that was updated after the fact. You can imagine that I’m not keen on updating 1800 posts one at a time. Not to mention, I shouldn’t have to.
I installed a different search/filter plugin (Filter Custom Fields & Taxonomies Light) and it displayed results correctly. Though, I don’t like that plugin for its UX and various other reasons. It doesn’t have any problem pulling the custom taxonomy value from the post. You can see those results pulling from the same CPT here:
http://tap.voltaic.xyz/test-search/
I really need a resolution for this issue. I’ve spent at least 8 hours trying various things to resolve it. Please help.