How to set value in a custom column in wordpress?

It doesn't work at all.function owner_columns($columns){$columns['views'] = 'Owner';retur

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/

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745470269a4629100.html

相关推荐

  • How to set value in a custom column in wordpress?

    It doesn't work at all.function owner_columns($columns){$columns['views'] = 'Owner';retur

    1小时前
    10

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信