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 add my custom taxonomy column with this code:

function manage_my_category_columns($columns)
    {
     if ( !isset($_GET['taxonomy']) || $_GET['taxonomy'] != 'products' )
     return $columns;
     $columns['image_column'] = 'Image';
     return $columns;
}
add_filter('manage_edit-products_columns','manage_my_category_columns');

function manage_category_custom_fields($deprecated,$column_name,$term_id){
     if ($column_name == 'image_column') {
       $t_id = $term_id;
       $cat_meta = get_option( "products_$t_id");
       echo "<img src='".$cat_meta['img']."' style='height:50px;width:50px;'/>";

     }
    }
add_action('manage_products_custom_column','manage_category_custom_fields',10,3);

When I add new category, custom column not shown immediately after create: enter image description here

After page refresh the custom column will be shown: enter image description here

Is there any way to show custom column with default columns immediately after create new category?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

What is happening is that:

  • the page /wp-admin/edit-tags.php uses $_GET['taxonomy']

  • and /wp-admin/admin-ajax.php, fired when we create a new term, uses $_POST['taxonomy']

To solve it, use $_REQUEST in manage_my_category_columns().
It will cover both GET and POST:

if ( !isset( $_REQUEST['taxonomy']) || $_REQUEST['taxonomy'] != 'products' )

Related Q&A:
WP List Table custom quick edit box - post meta data missing and columns change on submit

share|improve this answer
    
Yep, work like a charm. Thanks you –  Nulled May 6 '13 at 7:26

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.