Opened 2 years ago

Last modified 8 months ago

#15963 new defect (bug)

Don't try to add orphaned pages' parents' slugs to the page URL

Reported by: filosofo Owned by:
Priority: normal Milestone: Future Release
Component: General Version: 3.1
Severity: normal Keywords: has-patch 3.2-early needs-testing 2nd-opinion
Cc: mdhansen@…

Description

If a page becomes orphaned---in other words, if a page points to a parent object that doesn't exist any more---get_page_uri() doesn't sanity check that the parent object actually exists.

Patch does the check without any extra work, by moving stuff around.

Attachments (4)

avoid-notice-on-orphaned-pages.15963.diff (748 bytes) - added by filosofo 2 years ago.
15963.2.diff (429 bytes) - added by MikeHansenMe 8 months ago.
checks the status of the parent page before adding it to uri
15963.3.diff (438 bytes) - added by SergeyBiryukov 8 months ago.
Original patch, refreshed
15963.3.alt.diff (447 bytes) - added by SergeyBiryukov 8 months ago.
Same as 15963.2.diff, with proper formatting

Download all attachments as: .zip

Change History (6)

checks the status of the parent page before adding it to uri

  • Keywords needs-testing 2nd-opinion added

This seems to fix the problem in version (3.5-alpha-21751).

Code used to test:
<?php
$uri = get_page_uri(get_the_ID());
echo '<a href="'. $uri .'">The Page</a>';
?>
The output :
<a href="sample-page/thistoo">The Page</a>

My main concern is I was not using permalinks...

Version 0, edited 8 months ago by MikeHansenMe (next)

Original patch, refreshed

Same as 15963.2.diff, with proper formatting

  • Cc mdhansen@… added
Note: See TracTickets for help on using tickets.