Support

Account

Home Forums Backend Issues (wp-admin) Having trouble adding ACF field to admin columns Reply To: Having trouble adding ACF field to admin columns

  • Hi @brotsky_pixie

    It seems there are some changes on how to add the admin custom columns. Also, it seems you have several errors in your code. If your custom post type is “staff”, could you please try the following code?

    function my_page_columns($columns)
    {
        $columns = array(
            'cb'         => '<input type="checkbox" />',
            'title'     => 'Last Name',
            'first'     => 'First Name',
            'date'        =>    'Date',
        );
        return $columns;
    }
    
    function my_custom_columns($column)
    {
        global $post;
        
        if ($column == 'first') {
            echo get_field( "first_name", $post->ID );
        }
        else {
             echo '';
        }
    }
    
    add_action("manage_staff_posts_custom_column", "my_custom_columns");
    add_filter("manage_staff_posts_columns", "my_page_columns");

    Because this is more related to WordPress, kindly visit WordPress community for further support.

    I hope this helps 🙂