[wp-trac] [WordPress Trac] #58345: Critical error if page_for_posts is set to non existing page ID
WordPress Trac
noreply at wordpress.org
Fri May 19 20:58:37 UTC 2023
#58345: Critical error if page_for_posts is set to non existing page ID
----------------------------+---------------------
Reporter: wplindavantol | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: 6.3
Component: Menus | Version: trunk
Severity: normal | Resolution:
Keywords: php8 has-patch | Focuses:
----------------------------+---------------------
Comment (by josklever):
When I investigated this issue together with @wplindavantol we've found
[https://www.google.com/search?q=nav-menu.php+406 other occurrences] of
this issue.
So it's probably a good idea to check if the post exists and if not set
the value to 0, like:
{{{#!php
if ( is_null($posts_page_obj) ) { update_option('page_for_posts', 0); }
}}}
Disclaimer: I'm not a developer, so this needs to be checked/tested.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/58345#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list