Support

Account

Home Forums Backend Issues (wp-admin) No taxonomies on CPTs, even when enabled

Unread

No taxonomies on CPTs, even when enabled

  • I’ve got a CPT called ‘Locations’ defined via ACF. Under Taxonomies on the Edit Post Type screen I’ve enabled tags but the Tags metabox doesn’t show up on the Edit Post page, under quick edit or in the menu under Locations. This worked at one point because I was adding tags to this post type several weeks/months ago, but it seems to have stopped working via a recent ACF or WordPress update and I’ve only just noticed.

    I tried creating a brand new CPT and enabling Tags there and they don’t show up on that one either, so it’s not a problem specific to this post type.

    Here’s the post type registration (obtained via Tools > Export PHP). As you can see, post_tag is included there. I also tried enabling Categories and these don’t appear either.

    
    add_action( 'init', function() {
    	register_post_type( 'location', array(
    	'labels' => array(
    		'name' => 'Locations',
    		'singular_name' => 'Location',
    		'menu_name' => 'Locations',
    		'all_items' => 'All Locations',
    		'edit_item' => 'Edit Location',
    		'view_item' => 'View Location',
    		'view_items' => 'View Locations',
    		'add_new_item' => 'Add New Location',
    		'add_new' => 'Add New Location',
    		'new_item' => 'New Location',
    		'parent_item_colon' => 'Parent Location:',
    		'search_items' => 'Search Locations',
    		'not_found' => 'No locations found',
    		'not_found_in_trash' => 'No locations found in Trash',
    		'archives' => 'Location Archives',
    		'attributes' => 'Location Attributes',
    		'insert_into_item' => 'Insert into location',
    		'uploaded_to_this_item' => 'Uploaded to this location',
    		'filter_items_list' => 'Filter locations list',
    		'filter_by_date' => 'Filter locations by date',
    		'items_list_navigation' => 'Locations list navigation',
    		'items_list' => 'Locations list',
    		'item_published' => 'Location published.',
    		'item_published_privately' => 'Location published privately.',
    		'item_reverted_to_draft' => 'Location reverted to draft.',
    		'item_scheduled' => 'Location scheduled.',
    		'item_updated' => 'Location updated.',
    		'item_link' => 'Location Link',
    		'item_link_description' => 'A link to a location.',
    	),
    	'public' => true,
    	'show_in_rest' => true,
    	'menu_position' => 2,
    	'menu_icon' => 'dashicons-location',
    	'supports' => array(
    		0 => 'title',
    		1 => 'revisions',
    		2 => 'thumbnail',
    		3 => 'custom-fields',
    	),
    	'taxonomies' => array(
    		0 => 'post_tag',
    	),
    	'has_archive' => 'locations',
    	'rewrite' => array(
    		'slug' => 'messages',
    		'with_front' => false,
    		'feeds' => false,
    	),
    	'delete_with_user' => false,
    ) );
    } );
    
    add_filter( 'enter_title_here', function( $default, $post ) {
    	switch ( $post->post_type ) {
    		case 'location':
    			return 'Location name';
    	}
    
    	return $default;
    }, 10, 2 );
    
Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.