I just upgraded from 4.2 to 4.4 and now my taxonomy query returns empty. It has been working fine prior to the upgrade.

I have registered a custom taxonomy named 'title', which is used by my custom post type 'sg-publications'. Following the WP template hierarchy I created a template called taxonomy-title.php which uses the default query args, and up until now has correctly shown each publication by it's title.

Here is the output of $queried_object and $wp_query->request in that template:

[queried_object] => WP_Term Object
        [term_id] => 1256
        [name] => Stroupe Scoop
        [slug] => stroupe-scoop
        [term_group] => 0
        [term_taxonomy_id] => 1374
        [taxonomy] => title
        [description] => 
        [parent] => 0
        [count] => 30
        [filter] => raw

[queried_object_id] => 1256

[request] => 
SELECT wp_posts.* 
FROM wp_posts 
INNER JOIN wp_term_relationships 
ON (wp_posts.ID = wp_term_relationships.object_id) 
WHERE 1=1 
AND wp_posts.post_title = 'stroupe-scoop' 
AND ( 
    IN (1374)
AND wp_posts.post_type = 'sg-publications' 
AND (wp_posts.post_status = 'publish' 
    OR wp_posts.post_status = 'private'
GROUP BY wp_posts.ID 
ORDER BY wp_posts.post_date 

The problem I see in the above query is right after WHERE 1=1, for some reason it is searching for post_title = 'stroupe-scoop'. This is not correct - that is the taxonomy term slug, not the title of the post. In fact, when I comment out that line and run it against the database I get the proper returns. So what is causing WP to add that condition, when (I assume) it was not adding it before I upgraded to 4.4?

Here is taxonomy-title.php:

 * @package WordPress
 * @subpackage Chocolate
  global $wp_query;

  $quer_object = get_queried_object();
  $tax_desc    = $quer_object->description;
  $tax_name    = $quer_object->name;
  $tax_slug    = $quer_object->slug;


$title = get_the_title( $ID );
$args  = array(
    'menu'            => 'new-publications',
    'container'       => 'div',
    'container_id'    => $tax_slug . '-menu',
    'menu_class'      => 'menu-top-style nav nav-tab',
    'menu_id'         => '',
    'echo'            => true,
    'fallback_cb'     => false,
    'before'          => '',
    'after'           => '',
    'link_before'     => '<i class="fa fa-chevron-circle-right fa-fw fa-2x"></i>',
    'link_after'      => '',
    'items_wrap'      => '<ul id="%1$s" class="%2$s">%3$s</ul>',
    'depth'           => 0,
    'walker'          => ''


<div id="page-title">
  <h1><?php _e( 'Publications - ' . $tax_name, LANGUAGE_ZONE ); ?></h1>
  <p><?php _e( 'View our monthly newsletter and stay informed on the latest real estate news.', LANGUAGE_ZONE ); ?></p>

<?php wp_nav_menu($args); ?>


<div id="multicol">

if ( have_posts() ) : while ( have_posts() ) : the_post();

get_template_part( 'loop' , 'title' );


</div><!-- end #multicol -->
<section class="page-text well"><?php _e( $tax_desc, LANGUAGE_ZONE ); ?></section>


And in functions.php I have this query filter:

// use pre_get_posts to remove pagination from publications
function gd_publications_pagination( $query ) {
  if ( is_admin() || ! $query->is_main_query() )

  if ( is_tax('title') ) {
    // Display all posts for the taxonomy called 'title'
    $query->set( 'posts_per_page', -1 );
add_action( 'pre_get_posts', 'gd_publications_pagination', 1 );
  • Where is the query code? If it's in your template then why don't you just remove the part that's breaking it? If it's not - what did you use to generate the query? Dec 21, 2015 at 16:26
  • There is no custom query code, I'm using the WP default loop. Because I'm following the Template Hierarchy, WP should (and has, prior to upgrade) generate the correct query parameters for my taxonomy.
    – Gary D
    Dec 21, 2015 at 16:54
  • 2
    What's the contents of your taxonomy-title.php? Did you look in theme's functions.php to check if there are any filters on the main query? Dec 21, 2015 at 17:00

1 Answer 1


I wouldn't recommend using a taxonomy slug that coincides with the public query variables, like title.

The title query variable was introduced in 4.4 so I think that could explain your problems.

Check out this part of the WP_Query class:

    if ( '' !== $q['title'] ) {
        $where .= $wpdb->prepare( 
            " AND $wpdb->posts.post_title = %s", 
            stripslashes( $q['title'] ) 

So when we use for example:


what should WordPress do here? Is it a taxonomy query or title search?

So I would recommend prefixing the custom taxonomy slug, e.g.


to avoid possible name collisions.


Thanks to @ocean90 for pointing out that this is a bug, that will be fixed in 4.4.1

  • 2
    Thanks for the heads up on the change in 4.4 - I had a suspicion it might be a naming conflict. I'll follow once I run a few tests.
    – Gary D
    Dec 21, 2015 at 17:42
  • Until a few versions ago, you couldn't register a post type code, because that made the whole admin backend monospaced. Generic names are always collision candidates. On the other hand, WordPress should prefix its own internals.
    – fuxia
    Dec 21, 2015 at 18:44
  • Yes, that was it. Once I changed the taxonomy term and related filenames to a non-conflicting scheme, all came back up. Thanks again for pointing me at the updated WP code.
    – Gary D
    Dec 21, 2015 at 18:52
  • glad to hear it's up & running again @GaryD
    – birgire
    Dec 21, 2015 at 19:09
  • cool, I've to test that when I get my hands on an old install ;-) I would definitely support that prefix ticket, but I don't see that going through in the near future, sadly @toscho
    – birgire
    Dec 21, 2015 at 19:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.