• I have a very odd issue I have been trying to resolve for quite awhile.

    When a user creates a new blog post it sometimes overwrite a previous post. It seems to pick up that previous posts ID and completely replaces everything on that post.

    I have been unable to replicate this problem and all I have to go on so far are the access logs. For example

    We see this in the logs
    [27/May/2025:15:21:17 +0000] “GET /blog/api-governance-is-about-people/?preview_id=58417&preview_nonce=8dd4df8a5c&_thumbnail_id=58420&preview=true HTTP/1.0” 200 – “https://tyk.io/wp-admin/post.php?post=58417&action=edit” “Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.3 Safari/605.1.15”

    That blog has the slug /blog/api-governance-is-about-people/ as its ID is 58417

    It is succesfully viewed ( a few times)
    “GET /blog/api-governance-is-about-people/ HTTP/1.0” 200 – “-” “Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.74 Safari/537.36”

    We have many of these entries in the logs
    “POST /wp-admin/admin-ajax.php HTTP/1.0” 200 – “https://tyk.io/wp-admin/post.php?post=58417&action=edit” “Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.3 Safari/605.1.15”

    Then after awhile

    [27/May/2025:15:34:55 +0000] “GET /blog/api-governance-is-about-people/ HTTP/1.0” 404 – “-” “node”

    The URL is failing and we have this

    [27/May/2025:15:37:19 +0000] “GET /?p=58417&preview_id=58417&preview_nonce=8dd4df8a5c&_thumbnail_id=58423&preview=true HTTP/1.0” 200 – “https://tyk.io/wp-admin/post.php?post=58417&action=edit” “Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.3 Safari/605.1.15”

    The same post id is being previewed but the slug has gone.

    What the user told me is that they created the blog with the URL /blog/api-governance-is-about-people/ and published it confirmed all was working properly.

    They then proceeded to create a new blog – they did not clone – they started from scratch by clicking add new blog.

    When checking that second blogs id it has the same ID as the first confirming that creating this second blog overwrote the first.

    But why?

    I suspected cacheing – so have made sure that our Coudflare cacheing excluded the WP-Admin pages. We are on WP-Engine and as I understand it their cache automatically does this.

    I cannot recreate the issue on our staging site even though it is a direct copy of the production site.

    I cannot start adding test posts on the live site and cannot start switching off plugins there either.

    Has anyone come across an issue like this or have any pointers?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator threadi

    (@threadi)

    Interesting case, and I totally understand your confusion. Basically, I would assume that a plugin is influencing this, because it’s not normal WordPress behavior. So I have a few comments:

    • Is your staging system also on WP Engine? They offer an option for this. If so, check carefully that the settings for live and staging are exactly the same. If one cannot be customized in staging, contact WP Engine support so that you really have a 1:1 copy available.
    • Do the users experiencing this issue have limited access rights, or are they at least not administrators? If they are not administrators, you could make a reliable and active user an administrator and work with them to see if the problem still occurs.
    • Regarding the plugins, you could also check which ones might be affecting the management of posts. For example, I see the plugin “Molongui Authorship” in the project, which I am not familiar with, but based on the description, it could very well be interfering here. You can certainly rule out other plugins by looking at which ones are very well known. Plugins that are not used as actively may contain such bugs, but they are not widely known.

    I know that when these things in production happen and you cannot replicate in testing env its a pain in the *ss… I recently had something similar and only after updating my docker container (probably after updating all the packages) it was solved miraculously. But this is not always the case.

    So here you need to implement some logging features within your production server, to try to catch the issue and try to go down to the problem.

    If I were you I would go, first the easy path.

    I’m expecting that you are able to replicate this consistently in your production server, otherwise, you are seriously screwed. If you can replicate this, then its time to remove all plugins and start adding them one by one and see if you can find a culprit among them.

    If none of the plugins are causing the issue, you might need to go to plan B: disabling all server-related features (simplify all server rules, .htaccess, caching services, etc). If you are using Cloudflare, remove all caching features also, leave it as direct access.

    And if nothing of this is working, it’s time for debugging. Time to go deep into the add post part of the code, and see what’s going on behind the scenes. I would install xdebug to your php service, and connect to it. If you are not happy with this, you can always write some error_log or var_dump with exit and check the resulting variables… this is hard job and the last resort, but there isn’t much else you can do.

    PS: @threadi is fast AF writing answers 🤣

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘New Posts overwriting previous posts’ is closed to new replies.