• Resolved benct

    (@benct)


    We are using the plugin ‘Custom Permalinks’ to overwrite the deafult url of some Custom Post Types we have registered.

    e.g. we have a registered a custom post type called region. We then use the ‘Custom Permalinks’ plugin to change the url from
    ….com/region/post-name/
    to
    ….com/post-name/

    This works correctly, initially but shortly afterwards, these posts then 301 redirect to the homepage.

    If we click refresh the permalinks and refresh our hosts cache (Flywheel – NGINX), then the redirects work correctly again for a short period before redirecting back to the homepage again.

    Talking with our hosts, we have found that disabling the Yoast SEO plugin, appears to stop the issue

    If anyone could help shed any light on how to overcome this, it would be much appreciated.

    Thanks,
    Ben

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Sami Ahmed Siddiqui

    (@sasiddiqui)

    Hi @benct

    Please add the following code snippet in your theme functions.php (If it’s custom theme) or create a child theme and add it in it’s function.php file:

    add_filter( 'wpseo_premium_post_redirect_slug_change', '__return_true' );

    This snippet disable the Yoast redirect functionality as documented here:
    https://developer.yoast.com/customization/yoast-seo-premium/disabling-automatic-redirects-notifications/

    Please let me know if you have any other question.

    Thanks & Regards,
    Sami

    Thread Starter benct

    (@benct)

    Thanks for the suggestions @sasiddiqui . We’re not using the premium Yoast plugin I’m afraid. I did try the code snippet anyway but it didn’t work.

    Same thing happens as always, we resave permnalinks and flush cache and the urls work temporarily. Try the pages again 2 minutes later and they 301 to the homepage.

    Thanks

    Plugin Author Sami Ahmed Siddiqui

    (@sasiddiqui)

    @benct This is really strange that permalink works for 2 minutes and then start redirecting. Have you contacted Yoast SEO Team? Also, have you verified that once the Yoast SEO plugin is disabled permalink works fine longer time?

    Thanks & Regards,
    Sami

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Custom posts redirecting to the home page’ is closed to new replies.