Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I removed the categories column from "All posts" page by applying this code.

add_filter("manage_edit-post_columns", "my_post_edit_columns");
function my_post_edit_columns($columns){
  unset($columns['categories']);
  return $columns;
}

This code removed categories column. But still i see the categories filter in the top. Is there a way to remove it other than using CSS to hide it?

Thanks

share|improve this question
1  
That's because there is no relation between the categories column and the filter. You should look for another hook/filter with which you can remove the filter on top. –  hakre Dec 31 '11 at 21:39

2 Answers 2

up vote 2 down vote accepted

I tested this and it works for removing the categories dropdown on the All Posts page:

add_action( 'load-edit.php', 'no_category_dropdown' );
function no_category_dropdown() {
    add_filter( 'wp_dropdown_cats', '__return_false' );
}

-- below: old answer when I misunderstood the question --

The code you posted works just fine for me. But here's an alternative you might try:

add_filter("manage_posts_columns", "my_post_edit_columns" );
function my_post_edit_columns($columns){
    unset($columns['categories']);
    return $columns;
}

This will also impact other post types that have a 'categories' column.

share|improve this answer
    
It's not about the column, but the filter on top of the table (as written in the question). –  hakre Dec 31 '11 at 21:40
    
Ah, I understand now. I was thinking of the screen options checkbox. –  Kailey Lampert Dec 31 '11 at 21:49
    
Yep. I want to remove that categories filter. I searched for hooks in this site but couldn't find anything. :( –  Giri Dec 31 '11 at 21:56
    
Edited my answer and added new code now that I understand the question. Sorry for my confusion! :) –  Kailey Lampert Dec 31 '11 at 22:22
1  
Remove bulk action with: add_filter( 'bulk_actions-' . 'edit-post', '__return_empty_array' ); Not sure about date, I'm looking though. –  Kailey Lampert Dec 31 '11 at 22:49

I think the select elements are passed through the wp_dropdown_cats filter. So you should be able to add a filter to that which returns a blank string.

share|improve this answer
    
Can you give me some sample code? I'll try it –  Giri Dec 31 '11 at 22:13
    
add_filter( 'wp_dropdown_cats', 'remove_dropdown_cats' ); function remove_dropdown_cats(){ return ''; } edit: go with Kailey's code, attatching it all to the load-edit.php action is a good idea. –  postpostmodern Dec 31 '11 at 22:23
    
Is it possible to apply code for "date" and "bulk actions" filter too? –  Giri Dec 31 '11 at 22:45

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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