Viewing 12 replies - 1 through 12 (of 12 total)
  • We have not had any complaints about this happening before.
    I just tested in several version of WP on a few different environments and everything saves correctly.

    It is possible that there is another plugin taking over the save post functionality and returning before the redirect setting are saved. Have you also checked if the other settings are not updating or is it just the redirect type?

    Regards,
    Don

    Thread Starter soulstatic

    (@soulstatic)

    Thanks, Don. Just the redirect type.

    Thread Starter soulstatic

    (@soulstatic)

    I’ve tried deactivating all the other plugins. Still no worky.

    What version of WP and what theme are you using?

    Thread Starter soulstatic

    (@soulstatic)

    WordPress 4.2.2. Custom theme.

    Thread Starter soulstatic

    (@soulstatic)

    One more wrinkle: When I create a new post, it works. It’s just when I go back and edit an old post. Maybe I should just edit directly through the database?

    You can, although that is a hassle.

    It sounds more like there is some form of issue with the post update hook – like I said, it sound like something might be conflicting with the saving of the data (even though you did check the plugins).

    Have you recently made changes to your custom theme, possibly?

    Thread Starter soulstatic

    (@soulstatic)

    We did. But nothing on single.php. Or the custom post type single page templates. Yeah, it would be a hassle. But I’m not seeing another option really. Truly grateful for you responding and trying to help. The client doesn’t do any of the backend work, so they don’t see the issue. Just time to roll up my sleeves! We use your plugin on so many of our sites and it works fine, so no worries. Thanks again!

    Ok,
    But just one note – the changes to the theme would most likely have been something changed in the functions.php file, not the template files, as the issues are in the admin area on post save.

    Additionally, you could also add a filter to the wp_redirect() function and if there are any 302 redirects, change them to 301 before they happen by adding something like this to your theme’s functions.php file (after opening <?php tag).

    function fix_redirect_status_custom($status, $location) {
        if ((int)$status == 302)
            return '301';
        return $status;
    }
    add_filter( 'wp_redirect_status', 'fix_redirect_status_custom');

    Then you would not need to change anything in the database.
    You can check to make sure it is working correctly by checking a redirect pages header with a website like https://urivalet.com/ – where you can view header codes.

    Best of luck,
    Don

    Thread Starter soulstatic

    (@soulstatic)

    Thanks so much, Don. Will try and let you know.

    Hi Don. Just wanted to followup. Thanks again for your replies.

    We changed the theme to Twenty Fifteen and we get the same error.

    Urivalet is a cool site, when I use it, I see that my redirect is indeed a 301 redirect even though the front end says 302. So I am think I am all set. Just thought you would want to know.

    Thanks for the update!
    I will put a note in to check the post save functionality on the next revision of the plugin when I do it, just in case there is something that might be causing it in rare cases.

    Warmest Regards,
    Don

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘301s keep defaulting back to 302s’ is closed to new replies.