• Resolved adrianmcg85

    (@adrianmcg85)


    Hi, Im using ‘Custom Post Type UI’ in wordpress or my site but when im using a hyphen to separate words in a permalink i get a 404 error. Please help.

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

    (@tw2113)

    The BenchPresser

    Are you doing this via the rewrite slug field in CPTUI’s post type settings? or some other way to change it to a dash/hyphen?

    Also just in case, did you force clear your permalink rules by visiting the permalinks page?

    Thread Starter adrianmcg85

    (@adrianmcg85)

    No I’m not using ‘custom rewrite slug’ field.
    I have a htaccess file. I have tried removing this but had no luck.

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    # END WordPress
    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    That’s a server level and more specifically, apache level, configuration change that enables permalinks as a whole.

    Shouldn’t need to touch that at all.

    This would be more setting made in Settings > Permalinks for your admin menu, and for CPTUI-Specific parts, text fields when you were registering the post type. For example, if you had the post type slug of “product_type” but you wanted the URLs to use “product-type”, there’s a rewrite slug UI spot that you could set that with, in our plugin.

    Thread Starter adrianmcg85

    (@adrianmcg85)

    I’ve reverted to using underscore for my slugs. But I think they are not good for SEO.
    It could be to do with ‘rewrite’ and ‘custom rewrite slug’

    Thread Starter adrianmcg85

    (@adrianmcg85)

    I’m not sure how to use rewrite to stop hyphened slug going to 404.

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    You should have https://cloudup.com/cwOSsNoTmN2 available that you could put a dashed/hyphened version of the intended slug into. Once saved, assuming nothing else is oddly broken or misbehaving, the hypened versions of URLs should work and provide results.

    I also know I have https://github.com/WebDevStudios/custom-post-type-ui/issues/784 open that needs evaluated further and mulled on.

    Thread Starter adrianmcg85

    (@adrianmcg85)

    Strange my rewrite settings the same. As your cloudup. But seems to get 404.
    Really odd.
    Underscores work but not good for seo

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    did you try any other customizations/tweaks/fixes that you could try undoing to see if that helps longer term? Do you have perhaps a page with the same hyphen’d slug? or strangely enough even a media item/attachment can cause conflict.

    Thread Starter adrianmcg85

    (@adrianmcg85)

    No. I have custom post types. So the slugs should all be different.

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Yes, but pages and media all could have matching slugs, and thus cause issues.

    Say I have a page named “team”. Then i also go make a post type named “team”. Then I add a post in the “team post type of “michael-jordan”.

    I go to mydomain.com/team/michael-jordan/

    I can’t control or dictate if WordPress is going to think it should be grabbing the page “team” and then look for an actually non-existant child page named “michael-jordan” or if it should grab the single post “michael-jordan” from the post type. It thus just returns a 404 error.

    This is why I’m suggesting to double check pages for sure. I’ve also had it happen where the attachment had a matching slug, since attachments are technically a post type and get a URL. This one hasn’t happened frequently, but it has happened.

    Trying to help cover bases here.

    Thread Starter adrianmcg85

    (@adrianmcg85)

    There are no conflicting slugs. I’ve tried on local to use random with hyphens slug and still get 404.

    I’ll try with a new custom post type.

    The other thing it may be is yoast seo

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    hmm, wish I had more answers for things to try at the moment. Something with the query must not be coming out right, but I couldn’t effectively speculate what without having extra access.

    I know I’ve seen some odd moments with something like Relevanssi but at least as far as I can tell, this isn’t really a search issue

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘404 on multi word slug on permalink hyphens causing issue’ is closed to new replies.