Skip to content

WordPress: Creating default object from empty value in /public_html/wp-admin/includes/post.php on line 748

I wasn’t expecting to have to investigate an issue with my WordPress installation this evening, however I encountered an error that left me scratching my head and searching for a solution. In this post, I would like to share my journey of solving a mysterious error in my WordPress installation…

While trying to create a new post, I was faced with the following error messages:

Warning: Creating default object from empty value in /home/customer/www/ on line 748
Warning: Cannot modify header information - headers already sent by (output started at /home/customer/www/ in /home/customer/www/ on line 9

Troubleshooting Efforts

I hadn’t changed anything so encountering an error was a bit of a surprise. I checked whether or not updates had been applied to either WordPress or the plugins I have installed but none had been applied. I tried several ways to resolve the error, including disabling plugins, checking for updates, and editing post.php to simply comment out the failing lines to see what would happen, but nothing seemed to work.

I was getting more and more frustrated, but I was determined to find a solution.

The Solution

After some deeper investigation, I finally found the root cause of the error. I don’t know if this is something default in WordPress, or something my hosting company is doing (deploying a default image or suchlike), however the next AUTO_INCREMENT value for the primary key (ID) in _posts table in the WordPress database was set to a value that already existed. This caused a failure when creating a new record and generated the error.

To resolve the issue, I simply ensured the next AUTO_INCREMENT value was set to something that was actually available to use. In my specific instance, this involved editing the table structure for the _posts table in my WordPress database with phpMyAdmin.

Editing the next AUTO_INCREMENT value in phpMyAdmin
Editing the next AUTO_INCREMENT value in phpMyAdmin


Misleading errors can be annoying, but unexpected misleading errors are worse. Hopefully sharing my journey will help other WordPress users who may encounter a similar issue. Remember to never give up, even when it seems like you’re running down, because success is just around the corner.

Leave a Reply

Your email address will not be published. Required fields are marked *