I am using the permalink structure:

/%category%/%postname%/ in order to show my blog posts under their category in my url.

I have also installed WordPress SEO by yoast (if that helps) but I noticed that when I go to publish a page and selected a parent page the urls in the admin becomes:

http://www.mysite.com/current-page/current-page/ instead of: http://www.mysite.com/parent-page/current-page/.

However and I view the page from the website the url is correct. Only in the admin the problem occurs and it is pretty frustrating for the client.

Has anybody experienced the same problem? I am desperate cause I am looking for so many days and I have not found any solution at all.

If you want me to give any additional information I will be very happy to do so!!

Thank you in advance!

  • 1
    /%category%/%postname%/ is your permalink structure for posts, right? Then you go on and tell about your problems with pages. I don't understand.
    – offroff
    Apr 19 '12 at 10:18
  • If it works as intended on the frontend, why is the client fussed? I think this is a non-issue, and I hope you're client realises that spending so many days on this is costing them money ( if it isn't then you need to make sure it does, you're missing out! )
    – Tom J Nowell
    Apr 19 '12 at 10:25
  • @offroff I am writing the permalink structure (under settings/permalink) because I don't know if there is any way you can specify the pages permalink structure. What else you would expect me to tell you? Please give me some hints. TomJNowell to be honest I have not delivered the project yet but I assume that the client will be pretty confussed with this. In addition I wanted to know where the problem comes from in order to get better on development.
    – nickast
    Apr 19 '12 at 10:33
  • it made me confused but I hope I understand now
    – offroff
    Apr 19 '12 at 11:13
  • Thank you very much for trying to help @offroff however this snipper (I added it in functions.php) did not do anything in the way the urls are displayed in the admin when you are trying to add a new page. I also went to the permalinks page and saved them in order to refresh and I deactived the wordpress seo plugin but the problem is still there.
    – nickast
    Apr 19 '12 at 12:18

Edit. Here's another solution to not mess with the edit slug button.

The function get_sample_permalink_html in wp_admin/includes/post.php outputs the sample permalink and an edit button. It can be filtered like this:

function my_sample_permalink ($page_link,$id){
    $page = get_page($id);
    if($page->post_type == "page" && $page->post_parent) {
        $parent = get_page($page->post_parent);
        $page_link = preg_replace("/(sample-permalink\">).*?(<)/","$1".home_url('/').$parent->post_name."/$2",$page_link);
    return $page_link;

Can't say I like this solution but maybe it works for you.

  • Awesome!!! @offroff, that did the trick!!! Thank you very very much!! The only problem that I am facing right now is that I lost the edit slug button after the view page for a reason.
    – nickast
    Apr 19 '12 at 12:46
  • yeah, interesting :) I'll take a look.
    – offroff
    Apr 19 '12 at 12:51
  • Dear @Offroff!! The above filter works like a charm!!! Thank you very very much!! You are my hero!
    – nickast
    Apr 23 '12 at 21:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.