Hello,
Hopefully someone can give some advice š I’m not sure how to fix this, should I modify wp\_posts sql file? What should I modify or delete? Or just make a new website from scratch?
I had this issue for a while – blank white screen when trying to create a page or post. I had an old website, made it around 2017, 2018. Just in the past year decided to update it and faced this issue. I then moved hosting as old one was hard to work with and tried again, switched php to 8.1 but nothing helped. Tried disabling all plugins, enabling default theme, still nothing. If I disable all plugins etc I still get errors, just less of them. I enabled in wp-config.php to show errors and the errors are like this (they are actually not logged in wordpress log file, just saw them after enabling to show them on screen):
**Warning**: Attempt to read property “post\_type” on null inĀ **/home/exampleweb/public\_html/wp-includes/post.php**Ā on lineĀ **7580**
**Warning**: Attempt to read property “post\_type” on null inĀ **/home/exampleweb/public\_html/wp-includes/post.php**Ā on lineĀ **7581**
…
**Warning**: Attempt to read property “post\_type” on null inĀ **/home/exampleweb/public\_html/wp-content/plugins/jetpack/\_inc/lib/class-jetpack-recommendations.php**Ā on lineĀ **136**
…
**Warning**: Attempt to read property “post\_type” on null inĀ **/home/exampleweb/public\_html/wp-includes/theme.php**Ā on lineĀ **3862**
… etc
I was browsing online and found someone said some posts in wp\_posts table might have no value in phpMyAdmin:
[https://stackoverflow.com/questions/77539115/cant-add-new-page-or-post-in-wordpress](https://stackoverflow.com/questions/77539115/cant-add-new-page-or-post-in-wordpress)And I have a few of those, no value in post\_content. Some have no values in post\_content and post\_title. I downloaded wp\_posts table as sql file and opened it in DBeaver. I didn’t find any posts with post\_type value as null (empty) as the error suggests. They all are either posts, attachments or other things. I also see quite a few posts have ID value 0 (number 0), and a veeeeery long string of characters, seems to be related to “image-sitemap-1.xml” or “sitemap.xml”. Like this:
INSERT INTO `wp_example-posts` (`ID`, `post_author`, `post_date`, `post_date_gmt`, `post_content`, `post_title`, `post_excerpt`, `post_status`, `comment_status`, `ping_status`, `post_password`, `post_name`, `to_ping`, `pinged`, `post_modified`, `post_modified_gmt`, `post_content_filtered`, `post_parent`, `guid`, `menu_order`, `post_type`, `post_mime_type`, `comment_count`) VALUES
(0, 0, ‘2023-06-11 22:24:34’, ‘0000-00-00 00:00:00’, ‘PD94bWwgd6MjQ6MjhaP…veeeeeeeeeeeeeeeeery_loooooooooooooooong_liiiiiiiiiiiiiiiiiiiine…U6bG9jPjwvaW1hZ2U6aW1hZ2U+PC91cmw+PC91cmxzZXQ+Cg==’, ‘image-sitemap-1.xml’, ”, ‘draft’, ‘closed’, ‘closed’, ”, ”, ”, ”, ‘2023-06-11 22:24:34’, ‘0000-00-00 00:00:00’, ”, 0, ”, 0, ‘jp_img_sitemap’, ”, 0);
Now I can’t even open pages menu in wordpress – memory limit error, when I click on Pages in admin backend. I tried increasing to 512M but it didn’t help. And the error is:
**Fatal error**: Allowed memory size of 268435456 bytes exhausted (tried to allocate 268435464 bytes) inĀ **/home/exampleweb/public\_html/wp-includes/post.php**Ā on lineĀ **5898**
Here is log from server’s log file (deleted lines that were mostly same repeating error):
[12-May-2024 01:01:24 UTC] PHP Warning: Attempt to read property “post_type” on null in /home/exampleweb/public_html/wp-includes/post.php on line 7580…
[12-May-2024 01:01:24 UTC] PHP Warning: Attempt to read property “post_type” on null in /home/exampleweb/public_html/wp-content/plugins/jetpack/_inc/lib/class-jetpack-recommendations.php on line 136
…
[12-May-2024 01:01:24 UTC] PHP Warning: Attempt to read property “ID” on null in /home/exampleweb/public_html/wp-content/plugins/jetpack/jetpack_vendor/automattic/jetpack-sync/src/modules/class-posts.php on line 610
[12-May-2024 01:01:24 UTC] PHP Warning: Attempt to read property “post_type” on null in /home/exampleweb/public_html/wp-includes/theme.php on line 3862
[12-May-2024 01:01:24 UTC] PHP Warning: Attempt to read property “post_type” on null in /home/exampleweb/public_html/wp-includes/post.php on line 5516
…
[12-May-2024 01:01:24 UTC] PHP Warning: Attempt to read property “post_type” on null in /home/exampleweb/public_html/wp-admin/includes/post.php on line 769
[12-May-2024 01:01:24 UTC] PHP Fatal error: Uncaught TypeError: Automattic\Jetpack\My_Jetpack\Products\Jetpack_Ai::add_ai_block(): Argument #2 ($post) must be of type WP_Post, null given, called in /home/exampleweb/public_html/wp-includes/class-wp-hook.php on line 324 and defined in /home/exampleweb/public_html/wp-content/plugins/jetpack/jetpack_vendor/automattic/jetpack-my-jetpack/src/products/class-jetpack-ai.php:583
Stack trace:
#0 /home/exampleweb/public_html/wp-includes/class-wp-hook.php(324): Automattic\Jetpack\My_Jetpack\Products\Jetpack_Ai::add_ai_block(”, NULL)
#1 /home/exampleweb/public_html/wp-includes/plugin.php(205): WP_Hook->apply_filters(”, Array)
#2 /home/exampleweb/public_html/wp-admin/includes/post.php(808): apply_filters(‘default_content’, ”, NULL)
#3 /home/exampleweb/public_html/wp-admin/post-new.php(66): get_default_post_to_edit(‘page’, true)
#4 {main}
thrown in /home/exampleweb/public_html/wp-content/plugins/jetpack/jetpack_vendor/automattic/jetpack-my-jetpack/src/products/class-jetpack-ai.php on line 583
Check your posts table – something is returning a null on post_type.