3

I am using wp 3.5 i have a custom post (sp_product) and also i have custom taxonomy. I want to remove that custom taxonomy filter column but i don't want to make 'show_admin_column' => false.

I wanna unset from $columns[''] .

How should i do that ? i also want to add some css/js when it will show in column and top select menu. (showing in this image like)

enter image description here

2
  • Probably, unsetting the column will be as easy as adding one: in manage_edit-CPT_columns and unset($columns['CUSTOM-TAXONOMY']), have you tried it? ::: Can you clarify this: "add some css/js when it will show in column and top select menu", I don't understand even with the screenshot... Commented Jan 10, 2013 at 13:59
  • Sorry for my bad English. In that picture using chosen (jQuery plugin) so i want to use that kind of js/css in my filter menu. so, how should i do that, where should i put those js/css cods ? Commented Jan 11, 2013 at 3:53

1 Answer 1

4

To hide columns in a Custom Post Type screen, you need the filter manage_{$this->screen->id}_columns.

add_filter( 'manage_edit-sp_product_columns', 'hide_cpt_columns_so_14257172' );

function hide_cpt_columns_so_14257172( $columns )
{
    // Change categories for your custom taxonomy
    unset($columns['categories']);
    return $columns;
}

To add custom CSS/Javascript in a specific screen, you can use the action admin_head-$hook_suffix. The following code hides the Show all dates, View all categories and Filter elements:

add_action( 'admin_head-edit.php', 'custom_css_js_so_14257172' );

function custom_css_js_so_14257172() 
{
    // Apply only in the correct CPT, otherwise it would print in Pages/Posts
    global $current_screen;
    if( 'sp_product' != $current_screen->post_type)
        return;
    ?>
        <style>
            select[name="m"] { display:none }
            select[id="cat"] { display:none }
            #post-query-submit { display:none }
        </style>
    <?php
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.