• Resolved Julie

    (@habannah)


    I created a custom taxonomy (Destinations) using a plugin, then noticed that the spelling wasn’t what I wanted so created a second, correct taxonomy (Destination — no “s” at the end). Now I’d like to remove the first one I created (Destinations).

    The plugin support page says it’s not possible to remove custom taxonomies, but I found the following codes to remove/unregister them:

    function unregister_taxonomy(){
    	global $wp_taxonomies;
    	$taxonomy = 'taxonomy_to_remove';
    	if ( taxonomy_exists( $taxonomy))
    		unset( $wp_taxonomies[$taxonomy]);
    }

    AND

    add_action( 'init', 'unregister_taxonomy');
    function unregister_taxonomy(){
    	global $wp_taxonomies;
    	$taxonomy = 'taxonomy_to_remove';
    	if ( taxonomy_exists( $taxonomy))
    		unset( $wp_taxonomies[$taxonomy]);
    }

    I tried to run the query but am getting an error message:

    #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '<php
    
    function unregister_taxonomy() {
        global $wp_taxonomies' at line 1

    I’m sure it has something to do with where I’m placing the name of the custom taxonomy. Where exactly should I be placing “Destinations”? I’ve tried a few different ways, but it’s not going to work if it’s just guesswork, that much is clear…

    And, I think there may be a problem with the code itself… Syntax maybe? Any clues?

    Sorry, but I don’t know any php and am just trying to figure out this one (fairly little) problem. Thanks so much for any help than can be offered!

Viewing 1 replies (of 1 total)
  • Thread Starter Julie

    (@habannah)

    I sat on this for the past week hoping for some advice, but another question entirely is what finally led me to the answer to this question tonight.

    Ultimately, uninstalling and deleting the plugin did the trick. However, I didn’t want to lose all my hard work, so here’s what I did, if anyone ever finds themselves in a similar situation…

    The plugin I was originally using was called Custom Post Taxonomy GUI Manager. It only allowed taxonomies to be assigned to posts, pages, and feedback. But I realised I have a need to assign custom taxonomies to media attachments as well. The plugin I found which would accomplish this purpose (and much more!) is called Simple Taxonomy.

    Simple Taxonomy allows the deletion of created taxonomies, unlike the CPT GUI Manager. So using yet another plugin, Term Management Tools, I transferred all my “Destination” posts to a new taxonomy I created, “Places” (to avoid duplication in naming and possible relationship problems between the two). Then I uninstalled/deleted the unsuitable plugin, CPT GUI Manager, and created yet another custom taxonomy called “Destinations” (Simply Manager lets you set plural and singular spellings, so there’s no more confusion!). I then transferred everything from Places to Destinations, and deleted Places.

    By doing it this way, none of my URLs changed so I didn’t have to update any links manually; I retained all my custom descriptions; and all posts originally assigned to the terms are still there ?? To me, this worked perfectly.

    I’ll come back to mark this topic as closed in a few days, but if anyone has any suggestions as to how they would have done things differently, I’d love to know! Thanks!

Viewing 1 replies (of 1 total)
  • The topic ‘Removing custom taxonomy — almost there’ is closed to new replies.