Parent Pages in Permalink Twice for Draft Posts
-
When setting a Parent Page for a draft post the permalink shown in the editor has any parent pages listed twice.
For Example:
I create a new page “Sample Page” and assign the page “Parent Page” as the parent the preview permalink should be the following
https://test.test/parent-page/sample-page
But it shows up as:
https://test.test/parent-page/parent-page/sample-page
This is caused by the fix_get_sample_permalink function you’ve attached to the get_sample_permalink filter.
Line 1550 of custom-status.php
$permalink = str_replace('%pagename%', "{$uri}%pagename%", $permalink);
Is there a reason you’re adding the $uri to the the %pagename% placeholder? When I remove the $uri the permalinks all return correctly.
Note this issue is only for posts that are not published. Once published the permalinks preview correctly, since they’re no longer needing the get_sample_permalink.
- The topic ‘Parent Pages in Permalink Twice for Draft Posts’ is closed to new replies.