#15963 closed defect (bug) (fixed)
Don't try to add orphaned pages' parents' slugs to the page URL
Reported by: | filosofo | Owned by: | DrewAPicture |
---|---|---|---|
Milestone: | 4.4 | Priority: | normal |
Severity: | normal | Version: | 3.1 |
Component: | Posts, Post Types | Keywords: | has-patch needs-docs |
Focuses: | Cc: |
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 (8)
Change History (28)
#1
@
12 years ago
- 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...
#4
@
9 years ago
- Keywords needs-refresh added; 3.2-early needs-testing 2nd-opinion removed
- Milestone changed from Future Release to 4.4
- Owner set to chriscct7
- Status changed from new to assigned
#7
@
9 years ago
looks like 15963.3.alt.diff also had that issue.. My bad. Nice catch!
This ticket was mentioned in Slack in #meta by chriscct7. View the logs.
9 years ago
#10
@
9 years ago
- Keywords needs-unit-tests removed
15963.5.diff adds unit tests and updates the patch to be a bit simpler. Since it was referencing a post object anyway, we can avoid the call to get_post_status.
#11
@
9 years ago
- Owner changed from chriscct7 to wonderboymusic
- Status changed from assigned to reviewing
#13
@
9 years ago
- Resolution fixed deleted
- Status changed from closed to reopened
Hey guys! This patch is causing an issue for me as I have programmatically set private posts as parent. Can we add a filter to the output? I've included a patch.
#15
@
9 years ago
- Owner changed from wonderboymusic to DrewAPicture
- Status changed from reopened to accepted
checks the status of the parent page before adding it to uri