0

there a really well answered question about custom filters:

Adding a Taxonomy Filter to Admin List for a Custom Post Type?

but is seems that 'parse_query' filter is not suitable anymore to change list contents, since if I log &$query->query_vars from there, I get really uncomplete data, and cannot desume taxonomy, post_type and terms from there, as suggested by the many tuts out there.

Sample code:

add_action('parse_query', 'get_filtered_posts');
function get_filtered_posts($query){
  $qv = &$query->query_vars;

  // >>> logging $qv from here gives almost empty objects
}

So I was wandering: something wrong here (and thus 'parse_query' still valid) or maybe now there's some other way to do the job? By the way, I mean it with custom types and taxonomies, obviously.

0

There's a thing: this is not necessarily needed nowadays. This is not a strict answer to my question, but a possible very easy solution for most needs.

As of wordpress v3.5, you can pass 'show_admin_column' => true to register_taxonomy. This does 2 things:

  1. Adds the taxonomy column to the admin post type list view
  2. By clicking the name of the term on the taxonomy column, it will in fact filter the list to that term.

So, not exactly the same as having a select, but almost the same functionality, width just one row of code.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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