register_taxonomy('query_var'=>true) causing empty media library
-
Normally after looking up source code, or googling I can figure these things out, but this one has me scratching my head…
register_taxonomy()
with $args with'query_var' => true
in my themesfunctions.php
is causing an empty pop-up media library page that usually shows all my files..Playing around in the source code, I found that when I set
'query_var' => true
, the array that prints the media items ($GLOBALS['wp_the_query']->posts
inget_media_items()
inmedia.php
) is empty, instead of the 100s of posts that show whenquery_var => false
As I do need to query the var on the site, but not the admin, I’ve made this bandaid solution:
$queryvar = (is_admin()) ? false : true; register_taxonomy( ... , ... , array( ... 'query_var' => $queryvar, ... ));
But I’ve found lots of people online with the same issue, but no resolve on any threads, so my snippet above might be of help- but if anyone could shed some light on what’s going on that’d be great.
- The topic ‘register_taxonomy('query_var'=>true) causing empty media library’ is closed to new replies.