• Resolved designable

    (@designable)


    I am helping someone translate a site from english to czech. We have a custom post type named Recipes, which has a custom rewrite slug setup in English.

    I have changed the Custom Rewrite Slug from english to Czech, but the URLs are still showing in english. Rewrite is set to true for this post type, and I have tried re-saving the permalinks.

    How can I get the old URLs replaced with the new custom rewrite slug.

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    How are you trying to change the slug from english to czech? Via CPTUI’s settings? or via some other location like a translation plugin?

    Thread Starter designable

    (@designable)

    I’m using the Custom Rewrite Slug under Settings for this post type in CPTUI.

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Can you use the tools > debug info to email the details for your settings? Use michael@webdevstudios.com for the email address.

    More info: https://docs.pluginize.com/article/83-using-the-debug-info-tab-for-custom-post-type-ui

    I’m not presently able to recreate the issue, but I’m also not using the same values as you for settings. With my tests, I managed to have the slug change.

    One thing I must note though, which may be playing a part, is that while I’ve heard the rewrite slug is meant to be translatable, the way that we save our data and information is not translate friendly because of storing hardcoded strings in our options. I’m still waiting for a lightning bolt to the brain for how to get around this and make the labels better for i18n.

    Thread Starter designable

    (@designable)

    Ok I have sent the Debug info to your email using the Send Debug Info button. I appreciate your help with this.

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Forgive me for forgetting to ask this, but which post types/taxonomies are the troublesome ones here? Have any example urls of what you’re getting with an example of what you’re aiming for?

    Just as an example, I got http://wds.test/recepty/test-cake/ just fine, with the post type of “recipe” and “recepty” as the rewrite slug.

    I do see the 3 taxonomies that have rewrite slugs saved that include /’s to try to at least visually separate things out. However I can’t recall ever really seeing a lot of success with doing that, as it’s my understanding that’s trying to fit too much into a spot not meant for that purpose. I know full well that rewrite rule customization is a pain in the, but there’s still likely better ways to get those structures. I suspect this may be where the issues are coming in at for you, but I’m ready to be wrong as well.

    Thread Starter designable

    (@designable)

    Sure, it’s the Recipe custom post type. Here is a single recipe:
    https://testserver01.com/rumsonscz/recipes/single/rumsons-spiced-colada/

    this is what was in the Custom Rewrite Slug in Settings before I changed it:
    recipes/single

    I have changed it to: recepty

    I’m trying to get the link like this:
    https://testserver01.com/rumsonscz/recepty/rumsons-spiced-colada/

    I’m not against making all of these slugs simpler and removing the slashes. I’m not sure why the original developer did that. Thanks again for the help!

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    The fact that the urls are still resulting with the “single” in it, has me wondering where it’s coming from. It’s definitely not in the exported code received last night, so it’s not likely in the CPTUI options/settings at the moment. That said, is it possible that the post type is also getting registered somewhere else, like the functions.php file for your active theme? It’s possible you have a different spot registering similar, but not exact values for the same slug, and it’s being done after CPTUI has done it’s thing. Because of that possibly being run later, it would actually take precedence and be what’s used. Similar to how CSS works with matching selectors.

    Something to check on at least. That persistent “/single/” has me wondering.

    Thread Starter designable

    (@designable)

    OK I checked functions and the recipe post type was defined there also, with the recipe/single rewrite. Not sure why it’s defined in the CPTUI plugin AND manually in functions. So it wasn’t a problem with the plugin after all. I’m grateful for your time and attention, thank you.

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Tricky situation there, and there’s no indication ever from WordPress core that it’s being done twice.

    I have to believe that it was probably added to functions.php after being created as part of CPTUI settings, because we do check existing post types as a user types in the post type slug. It’ll pop up a warning message that that slug is already registered.

    Regardless, glad things have been resolved on your end. Have a good rest of your day.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Custom Rewrite Slug not working’ is closed to new replies.