6

I want to be able to customize the WordPress edit posts screen to filter based on a custom field (or whatever).

Unfortunately I'm not sure what filter or hook to use here, and instead of opening the code myself, figured I'd throw the question out here.

Just to be clear, I'm talking about this screen. Essentially I want to be able to add a new "tab" next to Drafts, Pending, etc.

enter image description here

Update After testing this, here's the solution:

add_filter( 'parse_query', 'filter_post_edit_screen' );
function filter_post_edit_screen($query) {
  global $pagenow;

  if (is_admin() && $pagenow=='edit.php'){
        $query->query_vars['category__not_in'] = array(120,9999);
  }
  return $query;
}

That's it. Just paste that into a plugin. Obviously you'd tweak the category IDs or add some more substantial code.

4

You need a to use a few hooks for that

take a look at mike's answer to a similar question.

Hope this Helps

  • 1
    Interesting, that looks like the right answer. I'll test, but I'll mark it correct now. =) – The How-To Geek Feb 15 '11 at 1:52
1

I found a plugin that might be a solution to your problem: http://wordpress.org/extend/plugins/extended-admin-post-filter/installation/
If that doesn't work then I think the only way out is to edit the WP core files (not recommended though) for the Edit Posts View & add a tab which filters posts according to the category or tag. This should work for sure! :)

  • 1
    Actually I already tested that plugin - it doesn't actually use any hooks, just adds the extra fields in there as drop-downs, since you can already filter with the query string by clicking on a tag or author name. – The How-To Geek Feb 15 '11 at 1:46

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.