johnbillion/extended-cpts

ACF taxonomy field displaying ID in admin_column and admin_filter instead of taxonomy name

thelar opened this issue · 2 comments

Hi,

I'm not sure if this is possible but thought I'd ask first before doing custom dev work...

I am using extended-cpts to register a new post type called 'product snippets' and then using ACF Pro to create some custom fields. One field is just a simple select with a 'type' value which is just simple text. The other however is a taxonomy field which uses an attribute from woocommerce called 'pa_brand-name'.

So I create a new a new product snippet post, select a type and select an existing brand taxonomy. But when I go to my admin list, I am able to see the type column and filter by type correctly, but the brand is showing up as just the taxonomy ID and not the brand name.

Here is my register code:

register_extended_post_type('product-snippets', [
        # Add the post type to the site's main RSS feed:
        'show_in_feed' => false,

        # Show all posts on the post type archive:
        'archive' => false,

        # Icon for the custom post type menu
        'menu_icon' => 'dashicons-editor-code',

        # Add some custom columns to the admin screen:
        'admin_cols' => [
            'type' => [
                'meta_key' => 'type'
            ],
            'brand' => [
                'meta_key' => 'brand',
            ],
        ],

        # Add some dropdown filters to the admin screen:
        'admin_filters' => [
            'type' => [
                'meta_key' => 'type'
            ],
            'brand' => [
                'meta_key' => 'brand',
            ],
        ],
    ], [
        # Override the base names used for labels:
        'singular' => 'Product snippet',
        'plural'   => 'Product snippets',
        'slug'     => 'product-snippets',
    ]);

And here is what I'm getting on my Product snippets admin page...

Screenshot 2021-03-11 at 13 18 07

And here is a screenshot of my Advanced Custom Field setup...

Screenshot_2021-03-11 Edit Field Group ‹ 4x4 Tyres — WordPress

Not sure if callbacks are going to help me here??

Thanks in advance
Kevin

It looks like you're using 'meta_key' => 'brand' for the column and the filter, instead of 'taxonomy' => 'brand'.

I'll close this off. Let me know if that doesn't fix the problem you're seeing!