admin管理员组

文章数量:1430726

It doesn't work at all.

  function owner_columns($columns)
     {
        $columns['views'] = 'Owner';    
        return $columns;
     }  
     add_filter('manage_edit-listing_columns', 'owner_columns');

  function custom_posts_table_content( $column_name, $post_id )
    {   
      if( $column_name == 'Owner' )
        {        
          echo 'Test';      
      }

     }     
  add_action( 'manage_edit-listing_custom_column', 'custom_posts_table_content',10,2);

It doesn't work at all.

  function owner_columns($columns)
     {
        $columns['views'] = 'Owner';    
        return $columns;
     }  
     add_filter('manage_edit-listing_columns', 'owner_columns');

  function custom_posts_table_content( $column_name, $post_id )
    {   
      if( $column_name == 'Owner' )
        {        
          echo 'Test';      
      }

     }     
  add_action( 'manage_edit-listing_custom_column', 'custom_posts_table_content',10,2);
Share Improve this question edited May 23, 2019 at 11:51 fuxia 107k39 gold badges255 silver badges459 bronze badges asked May 23, 2019 at 11:01 Lokesh DasLokesh Das 1013 bronze badges 2
  • I have edited your question and formatted the code properly. I'm not sure why you removed the formatting. – Johansson Commented May 23, 2019 at 11:19
  • thanks a lot, was a mistake – Lokesh Das Commented May 23, 2019 at 13:24
Add a comment  | 

1 Answer 1

Reset to default 0

You can also use Admin Columns plugin which makes your task easy.

If you want to go with custom solution > https://www.skyverge/blog/add-woocommerce-orders-list-column/

本文标签: How to set value in a custom column in wordpress