[wp-trac] [WordPress Trac] #58345: Critical error if page_for_posts is set to non existing page ID
WordPress Trac
noreply at wordpress.org
Thu Jun 22 05:25:31 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:
Severity: normal | Resolution:
Keywords: php8 has-patch changes-requested | Focuses:
----------------------------------------------+---------------------
Comment (by hbhalodia):
@audrasjb,
Got it, `$front_page_obj = get_post( $front_page );`, this check needs to
be checked in the first if statement. If any of the condition fails should
be fallbacking to the else statement. Something like below,
{{{
if ( ! empty( $front_page ) ) {
$front_page_obj = get_post( $front_page );
}
if ( $front_page_obj ) {
$front_page_obj->front_or_home = true;
$important_pages[] = $front_page_obj;
$suppress_page_ids[] = $front_page_obj->ID;
} else {
....
}
}}}
And for the `$posts_page_obj` there was no default `else` statement
previously. Should we need to add the same as we added for
`$front_page_obj`.
Let me know so that I can edit the patch correctly.
Thanks.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/58345#comment:10>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list