开发者

WP Admin: Filter for a Custom Taxonomy and see posts of any/all status?

On Admin > Edit Posts (edit.php), how can I filter for a Custom Taxonomy and see posts of ANY status, not just Published?

For example, say I have a Custom Taxonomy "Color"...

These queries find posts of ANY status:

  • edit.php?category_name=foo
  • edit.php?author=3
  • edit.php?tag=foo

And this query works correctly:

But this query finds ONLY Published posts:

  • edit.php?color=red


Drop this in a plugin or your theme's functions.php;

if (is_admin()):

function my_query_parser(&$query)
{
    if (!isset($_GET['post_status']))
        $query->query_vars['post_status'] = 'any';
}
add_action('parse_query', 'my_query_parser');

endif;

Personally I would class this as a bug in WP, I'll post it up in trac.

UPDATE:

It seems this trac entry mentions the issue, and it's reportedly fixed (probably in the nightly build).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜