Removing custom taxonomy — almost there
-
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!
- The topic ‘Removing custom taxonomy — almost there’ is closed to new replies.