skip to Main Content

I have run into a problem where I can no longer create new posts on my WordPress site.

I think this started after a WordPress update a while ago. I also have problems uploading images and I see ghost comments (an icon about new comments but no comments actually showing up in the list).

When clicking on "Posts > Add new" I get a white page with this warning:

"Warning: Creating default object from empty value in /public_html/wp-admin/includes/post.php on line 716"

This is line 716:

    $post->post_content = (string) apply_filters( 'default_content', $post_content, $post );

After searching online I think these issues are related to my database. I’m new to dealing with databases, so I’m hoping to maybe be able to get some help here.

Things I’ve tried:

  • Using a standard theme
  • Disabling all plugins
  • Updating WordPress
  • Downgrading to WordPress 4.0
  • Repairing the database tables
  • Running health check I found out that the SQL is old
    (5.5.52-MariaDB-cll-lve). Could this be relevant?
  • Checked the AUTO_INCREMENT box in phpMyAdmin for "wp_posts > structure > ID" and
    "wp_postmeta > structure > idmeta_id"

The auto_increment helped remove the error, but instead it caused some new problems. I activated it and could click "Posts > Add new". However, WordPress created multiple copies of the same post, around fifteen posts instead of just one. I trashed them and tried to create a new post, but it still remembered the trashed post and tried to recreate a new post from the post in the trash.

Links I’ve checked and tried:

I feel like this could be relevant as well, but I’m not sure how to make use of it:

8

Answers


  1. Chosen as BEST ANSWER

    Update: Just want to make clear that this is a workaround, I still don't know exactly what the issue was.

    Leaving this here in case someone else encounters the same issue. I asked my brother for help and since there were so many weird errors we decided to reinstall wordpress. This is how we did it:

    1. Took a backup with the Tools > Export option
    2. Went into the wp-config file and changed the table prefix name to a completely new one. $table_prefix = 'changethisname';
    3. Went to mysite.com/wp-admin and filled in the info in the WordPress installation.
    4. Went to Tools > Import > WordPress. Included attachments.
    5. It took about half an hour for all of the content to reappear, but it seems to be working correctly now.

  2. The error is because of the Auto_increment being disabled for the column ID of the table wp_posts. You can enable the Auto Increment option from the PhpMyAdmin.

    wp_posts -> Structure -> Change option for column ID -> Check the AUTO_INCREMENT option -> Save.

    You could run the following query within the database:

    ALTER TABLE wp_posts CHANGE ID ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT;`

    You may also need to enable Auto increment for the table wp_postmeta.

    Login or Signup to reply.
  3. If you are getting the error in post.php line 708

    Check the tables auto-increment and primary key feature.

    Login or Signup to reply.
  4. SOLVED upping the memory limit on Mysql

    Login or Signup to reply.
  5. Head to Phpmyadmin dashboard and try to find posts table, (it can also be in the name for example : abc_posts), -> go to structure, ->, then select ID, -> if Null is selected to auto increment, deselect, hit save then again, select Auto increment(AI), then save again. Try this, it works for me.

    Login or Signup to reply.
  6. I had the same error, and the issue was that the Mysql space was full. I just added more MB to my database and everything worked fine

    Login or Signup to reply.
  7. In my case , did all the things that you say , i found that the next auto increment value was equal to the last post ID( 500 ) in wp_posts table,then i added one to the auto-incremenet value ( 501 ) and sucessful.

    Login or Signup to reply.
  8. I solved this issue on a website I was working on by toggling the Auto Increment in the database. At first I couldn’t create new posts, pages, or upload images. I tried deactivating all plugins and updating everything but still no go. I realized it’s a database issue.

    I fixed this by going to wp_posts table in the database. Then go to Structure and then edit the first row which is ID. I then toggled the A_I box and saved.

    You can find the breakdown solution here:
    http://simplify.quedank.com/how-to-fix-warning-creating-default-object-from-empty-value-in-in-wordpress/

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search