• Hello!
    I am having a weird issue with custom taxonomies, and I am hoping to find the answer here…
    The problem:
    1: I have set up 2 custom taxonomies for the wordpress native posts: verdicts and sponsors
    2: At some point after the website was launched, the client can no longer save the sponsor taxonomy for a post, when editing a post. What I mean is , that checking the “sponsor” in the post edit page does not get saved. However, if I check the same taxonomy in the quick-edit section of the same post, in the post listing, it remains saved.
    3: The second custom taxonomy, verdicts, works fine
    My wordpress is all up to date as are my plugins and I have also tried disabling the plugin and enabling them one by one, and nothing.
    Can anyone please help?
    Thanks!

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hello,

    If you’re using the Block Editor then you’ll want to ensure that REST is enabled on the taxonomy. If the taxonomy is registered with a plugin you’ll want to ensure that the setting is enabled. If the taxonomy is registered with PHP then you’ll need to set the following setting to true:

    'show_in_rest' => true

    Otherwise, you may need to install something like the WordPress Health Check & Troubleshooting plugin so that you may safely disable plugins and revert to a default theme. At that point you can enable each one by one to narrow down where the conflict lies. For more information on debugging please see the Handbook Documentation. If you find that you’ve disabled all plugins, reverted to a default theme, and find that the issue persists then you may need to report back here with a bit more information regarding how the taxonomy is registered and what version WordPress and PHP you’re running.

    Thread Starter arafail

    (@arafail)

    @howdy_mcgee Thank you for the answer. I am using the classic editor and your solution did not work. I will use the plugin. Thank you!

    Thread Starter arafail

    (@arafail)

    Is there no one here who can help?
    Thanks!

    @arafail We’ll need more information. Did you use The Health Check and Troubleshooting plugin to narrow down which plugin or which theme is causing the issue? How is the taxonomy registered? Could you share the code? Have you tried enabling the Debug Logs to see if there are any errors generated on save?

    Thread Starter arafail

    (@arafail)

    Thanks for reply @howdy_mcgee
    1: I did not use the Health check, However I did disable all plugins and the issue was still there. The Custom taxonomy is included via my theme, and it did work until some point. Also, there is another identical custom taxonomy, which I included at the same time that still works.
    2: There is no error in the error log.
    3: Please see the code below

    <?php 
    // Register Custom Taxonomy
    function custom_sponsors() {
    
    	$labels = array(
    		'name'                       => _x( 'Sponsors', 'Taxonomy General Name', 'text_domain' ),
    		'singular_name'              => _x( 'Sponsor', 'Taxonomy Singular Name', 'text_domain' ),
    		'menu_name'                  => __( 'Sponsors', 'text_domain' ),
    		'all_items'                  => __( 'All Sponsors', 'text_domain' ),
    		'parent_item'                => __( 'Parent', 'text_domain' ),
    		'parent_item_colon'          => __( 'Item:', 'text_domain' ),
    		'new_item_name'              => __( 'New Sponsor', 'text_domain' ),
    		'add_new_item'               => __( 'Add New Sponsor', 'text_domain' ),
    		'edit_item'                  => __( 'Edit Sponsor', 'text_domain' ),
    		'update_item'                => __( 'Update Sponsor', 'text_domain' ),
    		'separate_items_with_commas' => __( 'Sepprate by comma', 'text_domain' ),
    		'search_items'               => __( 'Search', 'text_domain' ),
    		'add_or_remove_items'        => __( 'Add or delete', 'text_domain' ),
    		'choose_from_most_used'      => __( 'Add most used', 'text_domain' ),
    		'not_found'                  => __( 'Not Found', 'text_domain' ),
    	);
    	$rewrite = array(
    		'slug'                       => 'sponsor',
    		'with_front'                 => true,
    		'hierarchical'               => true,
    	);
    	$args = array(
    		'labels'                     => $labels,
    		'hierarchical'               => true,
    		'public'                     => true,
    		'show_ui'                    => true,
    		'show_in_rest' 				 => true,
    		'show_admin_column'          => true,
    		'show_in_nav_menus'          => true,
    		'show_tagcloud'              => true,
    		'query_var'                  => 'sponsor',
    		'rewrite'                    => $rewrite,
    	);
    	register_taxonomy( 'sponsor', array( 'post' ), $args );
    
    }
    
    // Hook into the 'init' action
    add_action( 'init', 'custom_sponsors', 0 );
    
    ?>
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Issue with saving custom taxonomes’ is closed to new replies.