• Resolved lucrus

    (@lucrus)


    I have (well, I had) a WP 5.6 with a custom theme and a few plugins (onw of which is custom modified) with a problem: when trying to add a new post or page (or to clone one with a plugin) it simply didn’t do anything.

    After disabling all plugins and custom theme the problem was still there. It wasn’t even letting me update WP to 5.7 (“another update is in progrss”) but there was no core_updater.lock option in wp_options.

    I suspected a hacked site, so I tried overwriting WP files from the official 5.7 tarball using the terminal (tar xzf latest-it_IT.tar.gz && cp -a wordpress/* ../public_html) while keeping all plugins disabled and default twenty-twentyone theme. Same problem.

    I then tried a clean WP 5.7 install with nothing else, only linked to a copy of the database of previous install, and I still get the same problem: I couldn’t add posts or pages.

    Then I enabled WP_DEBUG in the clean WP 5.7 install (which I already tried in the other 5.6 install) and I got the same error logs:

    WordPress database error Duplicate entry ‘0’ for key ‘PRIMARY’ for query INSERT INTO wp_posts (post_author, post_date, post_date_gmt, post_content, post_content_filtered, post_title, post_excerpt, post_status, post_type, comment_status, ping_status, post_password, post_name, to_ping, pinged, post_modified, post_modified_gmt, post_parent, menu_order, post_mime_type, guid) VALUES (3, ‘2021-04-01 08:44:10’, ‘0000-00-00 00:00:00’, ”, ”, ‘Auto Draft’, ”, ‘auto-draft’, ‘post’, ‘closed’, ‘open’, ”, ”, ”, ”, ‘2021-04-01 08:44:10’, ‘0000-00-00 00:00:00’, 0, 0, ”, ”) made by get_default_post_to_edit, wp_insert_post

    So now I assume there is a problem with my data, maybe previously caused by a bug in the customized plugin.

    Looking into the wp-posts table I’ve noticed there already is a row with ID=0, but even deleting that row, when I try to create a new post, I get the user interface as if the new post were alrady published (“update” instead of “publish” button) and if I try to “update” it I get only “A post type mismatch has been detected” error.

    Is there a way to find the problem in my database and fix it, so that at least clean WP starts working again? No, I have no database backup that is old enough, because my customer (the web agency in charge for managing the website) reached me out for this problem too late, when all potentially useful database backups were already gone.

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Cannot add new page or post (corrupted db?)’ is closed to new replies.