Support » Plugin: Groups 404 Redirect » Interoperability with Custom Permalinks plugin

  • Hi,

    Firstly I’d just like to say thank you for the Groups and Groups 404 Redirect plugins. They work really well for me.

    Yesterday however I found an issue where the the Groups 404 Redirect wasn’t redirecting for one of my posts – I kept getting the regular 404 response instead of a redirect.

    I did some digging and found that Groups 404 Redirect wasn’t playing nicely with another plugin that I use called Custom Permalinks (

    Custom Permalinks allows you to customise the URL for any page, post, category or tag. This caused an issue for Groups 404 Redirect plugin because it tries to resolve the post ID by using the request URL.

    I was able to fix the issue by resolving the post ID using a WP_Query object. I added the fix (10 extra lines) into my local copy of groups-404-redirect.php and it works.

    If the source code were in git, I’d create a pull request for you but… svn. If you want it, I can copy and paste the code fix into this thread unless there’s a better way to get it to you?

    Note: that I have only tested my fix with custom URLs on posts and not on pages, categories or tags so I can’t say for certain how they would be affected.

    Steps to reproduce issue:
    1. Start with a fresh WordPress (v4.9.3) installation
    2. In WordPress Dashboard, open Settings->Permalinks “Custom Settings” to “Day and name”
    3. Add a new post called “Standard URL Post” and publish it. Copy and paste the URL somewhere to use later.
    4. Add a new post called “Custom URL Post” and publish it.
    5. Install Custom Permalinks plugin (v1.2.17).
    6. Edit the “Custom URL Post” and change the permalink URL to “my-custom-url” and update it.
    7. View the post and you will see that it is now accessible under the new custom permalink URL.
    8. Install Groups plugin (v2.3.1)
    9. Install Groups 404 Redirect plugin (v1.4.0)
    10. In the Settings for Groups 404 Redirect, select: “Redirect to the WordPress login” and select the redirect status code of “Found (302) and save.
    11. Edit the “Standard URL Post”, set the Groups read access to “Registered” and update the post.
    12. Edit the “Custom URL Post”, set the Groups read access to “Registered” and update the post.
    13. Either log out of WordPress or open an incognito/private browser.
    14. View the “Standard URL Post” using the URL from the step 3 and you will be redirected to the Login page as expected.
    15. View the “Custom URL Post” using the custom URL http://<host>/my-custom-url and you will see a 404 page.

  • The topic ‘Interoperability with Custom Permalinks plugin’ is closed to new replies.