0

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)

3
function wpse_80027_manage_columns($columns) {
    // remove taxonomy column
    unset($columns['taxonomy-YOUR_TAXONOMY_NAME']); // prepend taxonomy name with 'taxonomy-'
    // add your custom column
    $columns['CUSTOM_COLUMN_NAME'] = __('Column Name');
    return $columns;
}
add_filter('manage_edit-sp_product_columns', 'wpse_80027_manage_columns');


function wpse_80027_add_img_column($name) {
    if('CUSTOM_COLUMN_NAME' == $name) {
        // echo your image in 'CUSTOM_COLUMN_NAME' column
        echo '<img src="image-name.png />';
    }
}
add_action('manage_sp_product_posts_custom_column', 'wpse_80027_add_img_column');
| improve this answer | |
  • 1
    This answer is actually partially incorrect. The correct context is unset($columns['taxonomy-{taxonomy_name_here}']); Just using the taxonomy name itself in the unset will not work. – Hybrid Web Dev Apr 19 '17 at 8:57
  • @HybridWebDev, you are perfectly right! Thank you for making a good point! My apologies, the answer is fixed now. – Max Yudin Apr 19 '17 at 12:38
0
add_action( 'init', 'unregister_taxonomy');
function unregister_taxonomy(){
    global $wp_taxonomies;
    $taxonomy = 'taxonomy_to_remove';
    if ( taxonomy_exists( $taxonomy))
        unset( $wp_taxonomies[$taxonomy]);
}
<php


function remove_taxonomy($taxonomy) {
    if (!$taxonomy->_builtin) {
        global $wp_taxonomies;
        $terms = get_terms($taxonomy); 
        foreach ($terms as $term) {
            wp_delete_term( $term->term_id, $taxonomy );
        }
        unset($wp_taxonomies[$taxonomy]);
    }
}

function deactivate_custom_taxes() {
    remove_taxonomy('post_tag');  // this will fail silently
    // do we need to flush the rewrite rules? 
    $GLOBALS['wp_rewrite']->flush_rules();
}

register_deactivation_hook( __FILE__, 'deactivate_custom_taxes' );
>

Please check this and let me know ....

| improve this answer | |
  • sorry to say i can't understand you answer . But i find its solution. and also thank you too. – zxprince Jan 11 '13 at 3:58

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.