[wp-hackers] Changing page permalink structure

Benjamin Lupu benjamin.lupu at gmail.com
Sun Sep 30 09:33:24 UTC 2012


Hi Brian,

Just to let you know that we're still working on this page issue. We have
now a prototype using regular Wordpress hooks and doing the following :

   - First I can add more regarding the current page permalink behavior :
   if you suppress all the parent page slugs from the URL (keeping only the
   final page slug), Wordpress does a 301 redirection to the whole permalink.
   It's the same if you suppress only one parent page slug. However, if you
   modify a parent page slug or the final page slug, you'll have a 404 error.
   - It drove us to try the same solution we have applied for posts :
   introduce the post/page id into the permalink so that even the slug
   changes, a 301 redirection is done based on the id
   - We've managed to have a prototype working based on regular hooks.
   Basically, what it does is to add /[page id]/ at the end of the permalink.
   Based on this id and even the whole URL changes, the plugin manages to
   build the correct 301 redirection to the new permalink. So far tests are
   good.

We've planned to release a beta version of a page manager with this feature
in the next few weeks.

Regards.

2012/9/23 Benjamin Lupu <benjamin.lupu at gmail.com>

> Thank you Bryan. I agree with you. Just to let you know that my developper
> and I have checked the core's code and we've found that there is no hook to
> manipulate page permalinks in it. I believe this is why there is no plugin
> with such functionality (to my knowledge). Before an option, I would like
> to have those hooks. With them, I will be fine with the current default
> behavior.
>
> Does anybody find one this hook in the current core's code ? (Just
> checking if we're wrong.)
>
>
> Date: Fri, 21 Sep 2012 09:35:07 -0600
>> From: Bryan Petty <bryan at ibaku.net>
>> Subject: Re: [wp-hackers] Changing page permalink structure
>> To: wp-hackers at lists.automattic.com
>> Message-ID:
>>         <CAKB8V+p1wTTHCDwpDL=sOy8oCP6hajD=
>> q5a0PMBr1s8Jpkqnjw at mail.gmail.com>
>> Content-Type: text/plain; charset=ISO-8859-1
>>
>> On Fri, Sep 21, 2012 at 3:03 AM, Benjamin Lupu <benjamin.lupu at gmail.com>
>> wrote:
>> > - By default page permalinks reproduce the breadcrumb to the page :
>> > http://[domain]/[top
>> > page slug]/[subpage 1 slug]/[subpage 2 slug]/[final subpage slug]
>> > - This structure is fine. However, sometimes I move pages or slightly
>> > modify the page tree
>> > - It causes permalinks to change as page/subpages dependencies have
>> changed
>> > too
>>
>> This is interesting because while pages have the "permalinks" feature,
>> and it would normally work as designed without any problems, it is
>> partially broken with the decision to use parent page slugs in the URL
>> for this reason.
>>
>> There might be a plugin that disables parent page slugs in the URL,
>> though I haven't seen one that does it yet. In your case (having pages
>> already published under those URLs), any plugin that does this though
>> would break all your existing pages though, so you will likely just
>> have to deal with this.
>>
>> This can quickly turn into a rather lengthy discussion debating which
>> behavior should be the default, and there's certainly good reasons for
>> both sides. On one side, it could be argued that permalinks are broken
>> (i.e. this is a bug) with parent page slugs being used. On the other
>> hand, many sites need that extra context for tons of pages that really
>> helps with SEO (when pages aren't moved). You could also argue that
>> the extra context can *still* be used without parent page slugs by
>> just adding it to your page slugs by hand.
>>
>> What I think would be an awesome compromise would be to disable parent
>> page slugs, but re-adjust the page slug generator for new pages to
>> prefix the new page slug with the slugs of parent pages at the time
>> the page is created or published.
>>
>> Regards,
>> Bryan Petty
>>
>
> --
> Benjamin Lupu
> Email: benjamin.lupu at gmail.com
>



-- 
Benjamin Lupu
Email: benjamin.lupu at gmail.com


More information about the wp-hackers mailing list