Support » Plugin: Simple Taxonomy Ordering » Taxonomies don’t work with superscript numbers

  • Resolved rjwordpress

    (@rjwordpress)


    Hello,

    I just installed Simple Taxonomy and let me tell you I am really happy with it!!! I think I just used it twice in the wrong way. I created two taxonomies with a superscript 2 for sqm. Unfortunately the system did not like this two taxonomies. I am not able to change them nor am I able to delete them.

    I would really appreciate your help for that matter.

    Many thanks in advance!

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Contributor yikesitskevin

    (@yikesitskevin)

    Hi @rjwordpress,

    Can you explain further what you mean by

    I created two taxonomies with a superscript 2 for sqm.

    What field did you add a superscript to? I’m guessing the odd character is breaking a SQL query (for some reason I can’t immediately think of).

    As a short term fix for the affected taxonomies, remove them from the sorted taxonomies (by going to the settings menu).

    Let me know,
    Kevin.

    • This reply was modified 3 years, 3 months ago by yikesitskevin.
    Plugin Contributor yikesitskevin

    (@yikesitskevin)

    I’ve just created a couple of taxonomy terms – 2014² and 2015² – and am able to order them (and fetch them in the correct order in a get_terms() query). Let me know if you have any more info.

    Many thanks for your quick response!

    I give you an example:

    I gave the field name: Construction m²
    The system created the label: construction-m%c2%b2

    I am no longer able to use the Modifier, it won’t open, nor am I able to delete the taxonomy.

    The system opens a new page and asks: Are you sure you would like to do this? Please try it again. If I try it again, I always get back to that page.

    Is there a limit of taxonomies that we can use? So fare I created 14.

    I hope my explanations are good enough. As you might figured out already, I am not a programmer.

    Greetings

    Plugin Contributor yikesitskevin

    (@yikesitskevin)

    Hi @rjwordpress,

    I think this is an issue with WordPress’ taxonomies and not with our plugin (i.e. WordPress does not support special characters in taxonomy names).

    If you disable our plugin, does anything change? I was seeing the same issue on the front-end on my site; although my terms 2014² and 2015² were saving, being ordered, and being pulled on the front-end correctly, they were not completely usable on the front end. When I disable our plugin, the taxonomy is still broken on the front-end.

    So, as I said, my conclusion is that WordPress does not support special characters within taxonomy names.

    I’m sorry about that. If you need help deleting the taxonomy that’s creating the error, you may want to try temporarily disabling the Modifier (is that a plugin?) – I am able to create/delete my 2014² and 2015² taxonomies without any issues.

    Cheers,
    Kevin.

    Plugin Contributor yikesitskevin

    (@yikesitskevin)

    After some googling, this might not be a WordPress issue but rather an encoding issue (where you’ll need to properly encode/decode the term names).

    Hello Kevin,

    Again many thanks for your answer! Right now I am just focussing on deleting these two wrong taxonomies. Unfortunately it is not possible at all. First I deactivated your plugin and activated it again: no result. Then I deactivated the plugin “search and filter” which directly uses the new taxonomies. Even then it was not possible to delete the taxonomies.

    As I figgured out now these two taxonomies cause even bigger problems. If I want to add a file like a picture to an existing post, the system won’t let me. The button does not react anymore. If I deactivate your plugin, everything goes back to normal and I can work on my posts like before.

    Is there no chance that you send me a piece of code that deletes this two unvalid taxonomies. But please let me also know where to put the code. 😉

    I am looking forward for your answer.

    Plugin Contributor yikesitskevin

    (@yikesitskevin)

    Hi @rjwordpress,

    Yes I can help you delete those two terms. First, we’re going to need to find two things: the name of the taxonomy and the ID of the term you’d like to delete.

    Taxonomy Name
    The name of the taxonomy can be found by looking at your URL when you’re on the taxonomy’s page. For example, if I go to the default “Categories” taxonomy, my URL looks like: https://{domain}/wp-admin/edit-tags.php?taxonomy=category. The taxonomy=category means the name of my taxonomy is category.

    Term ID
    To find the ID of the term, edit a term and look at your URL. It should look something like https://{domain}/wp-admin/term.php?taxonomy=category&tag_ID=1&post_type=post (although it may be a bit messier). Look for the tag_ID=1. This means your term’s ID is 1.

    Now we can create a function that will delete the terms. I will show you an example using the values above – so my term ID is 1 and my taxonomy name is category. The function should look like:

    add_action( 'admin_init', 'rjwordpress_delete_taxonomy_terms' );
    
    function rjwordpress_delete_taxonomy_terms() {
    
    	// Term id, taxonomy name
    	wp_delete_term( 1, 'category' );
    }

    All you need to do is replace the 1 with your term ID and the 'category' with your taxonomy name.

    You can add this function to your functions.php file, or if it’s easier you can download and install a plugin like my custom functions. Once it’s added, refreshing your taxonomy page (or any admin page) will delete the taxonomy term. Once you’ve deleted the terms, make sure to remove the code – it only needs to run once.

    You can either keep updating the same function to delete one term at a time, or you can do it all in one go. To delete multiple taxonomy terms, just copy and paste the wp_delete_term( 1, 'category' ); line and update it for each term you want to delete so it looks like:
    wp_delete_term( 1, 'category' );
    wp_delete_term( 2, 'category' );

    I hope that all makes sense. Sorry for the hassle.

    Cheers,
    Kevin.

    • This reply was modified 3 years, 3 months ago by yikesitskevin.

    Good morning Kevin,

    Let me tell you that your service is more than great and yes, what you write makes absolutely sense to me. And in case it doesn’t, I work it out.

    I was able to figure out the proper names of the taxonomies as you can see hereafter:

    Taxonomy 1: taxonomy=property-m²
    Taxonomy 2: taxonomy=construction-m²

    Unfortunately, the term ID is a problem, or maybe not, because I was not even able to create any terms for these two taxonomies.

    If I click on one of this taxonomy on my left menu a new page appears. But instead of showing possible terms, it just says: „Invalid taxonomy“. There are no invalid terms to delete. I simply would like to get rid of these two taxonomies itself. I guess I was not precise enough during my last posts and we had a misunderstanding here.

    Is there any chance we can delete a broken taxonomy (or however you name it) itself? Your code description and how to use it is really good. I think I can work with it. Now I just need the right code to delete the taxonomies.

    Once again, many thanks for your help in advance!

    Plugin Contributor yikesitskevin

    (@yikesitskevin)

    Ah! We’ve been working with two different use cases this whole time! I thought you were working with invalid taxonomy terms but you’re working with invalid taxonomies (as a whole).

    Apologies for the confusion. Let me do some research on how to delete the taxonomies. Don’t run the above code snippets as they will no effect on your site.

    Plugin Contributor yikesitskevin

    (@yikesitskevin)

    How did you add the taxonomy originally? Are you using a plugin to create taxonomies?

    I used the plugin simple taxonomy.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Taxonomies don’t work with superscript numbers’ is closed to new replies.