• We are running a WordPress multisite for the past 2 years with the same hosting service and only recently have seen this issue which has us scratching our heads. The WP version is 5.7.2, it is using a Let’s Encrypt SSL certificate to cover all the sub-domain sites. The site count is 120 and some sites having a decent amount of traffic and some are not busy. Each site(s) belongs to a client who does their own site content updates but we manage the WP updates and available plugins.

    The issue we are finding on the most recently added sites in the past month is that a client will add a page (or post) and will be able to edit that page as one would normally do. They can publish the page and view it. For instance https://site1234.com/wp-admin/post-new.php?post_type=page with a permalink of 20 will become https://site1234.com/?page_id=20 (issue is present regardless of permalink type). Now they view that page and they will see the title and content that they added.

    The client then goes to add a new page https://site1234.com/wp-admin/post-new.php?post_type=page just as they normally will. They add their content and publish this second page. They view the page and find out that they are now viewing the previous URL https://site1234.come/?page_id=20 with the new content for the second page.

    The client is now confused and the first page content is now lost as the revision data is based on the second page.

    Investigating this, we noticed that the page ID is not incremented on the second page edit and the page edit url slug is 20 still and the edit url is still https://site1234.com/wp-admin/post.php?post=20&action=edit when it really should have been https://site1234.com/wp-admin/post.php?post=**22**&action=edit

    On the add new page, if I view the page ID in the permalink area of the editor ‘page’ sidebar, I will continue to see the page ID of 20. To make the page ID advance, I would either have to do a CTRL-R reset of the page editor as soon as it opens; or after publishing a page, log out and log back in to WordPress. Clearing the browser cache will also increment the page ID. However this is not ideal UX for our clients.

    As part of this, if the editor is left open long enough, the autosave with start and if the page has not been published yet, we also see an ajax error (see last red box in the image below)

    As part of this issue is that when the client goes to the ‘Pages’ page to see the pages they have, sometimes this list is not updated. So they may see the original title from the first page, then a CTRL-R will refresh the page and they will see the 2nd edit title on the that page ID 20.

    Again, not a good user experience.

    The database size is 3.54GB with 12050 tables as reported by Plesk. Our instincts are telling us that there is an issue with ajax call to update the page information to the database when the page is published. Or that ajax request is being blocked to the server.

    What we have tried so far and still see this non-increment error.

    • running just the 2020 theme and no active plugins on the main site and /or sub site
    • running just the 2021 theme and no active plugins on the main site and /or sub site
    • deleting WP admin and includes files and reinstalling WP files back (in case there was some hacked files added to those folders
    • reviewing wp-config.php and .htaccess for any extraneous code
    • reviewing all wp folders for files that are not supposed to be there
    • when using our custom theme, ensure no PHP or javascript errors from the theme code
      optimizing the database, fix and repair through Plesk and myphpadmin until no errors
      reviewing error logs for any items that may cause conflicts, errors or warnings that may cause this problem
    • In the browser console, we have found admin-ajax.php connection errors and in the server log found that admin-ajax.php was being blocked on page editor load. The server was configured to not block this request
    • stop jquery-migrate.js from loading
    • require jquery-migrate.js to load
    • created a new WP multisite on the same server using the same WP config and htaccess files in the same directory and added our custom theme and plugins. Copied the main site from the problem multisite over and a couple other sites. The problem did not migrate over to the new site when creating new pages.
    • We had the sites running through Cloudflare for caching and other services that they provide. Stopped that connection and the problem persists.
    • Had WPRocket running for the last two years without many issues so we deleted the plugin and removed the added code to .htaccess and wp-config.php. Server activity was lowered due to the caching of files, optimizing, minification of all those sites were reduced.
    • when viewing the page data in the database, we can see that the ID is not updated but the content is as well as the date stamp.

    Currently using a workaround with javascript to check for the Page ID and if it is the same as the previous new page, hard refresh the editor until it has a new page ID. This is not ideal UX and may not catch it all the time. Best to fix the issue first and foremost.

    We are on a Linux server 3.10.0 x86_64, nginx, PHP limit 512M (also set to max available to WordPress). Total RAM I believe is 4GB. PHP 7.3.29. Databse 10.5.11-MariaDB mysqli All directories and files that need to be writable have the correct permissions.
    Admin.php error

    With all our typical plugins we found some errors from Editor’s Kit and ECWID Store as seen in the image below. Removing those plugins and errors still have the increment with new page error. console errors

    • This topic was modified 3 years, 8 months ago by johnamp. Reason: set list items
Viewing 1 replies (of 1 total)
  • Topher

    (@topher1kenobe)

    Make sure that the ID field in the database is large enough AND that auto-increment is on. I’ll bet AI is on, but you’ve filled up the buffer in your ID field. By default it’s a BIGINT, which should work forever, but if an optimization plugin pulled it down to something like SMALLINT then you’d be looking at a max of 65k posts or something.

Viewing 1 replies (of 1 total)
  • The topic ‘WordPress does not increment Page ID and overwrites previously saved page’ is closed to new replies.