[wp-hackers] Changing page permalink structure

Benjamin Lupu benjamin.lupu at gmail.com
Wed Oct 3 10:08:37 UTC 2012


:-)

Well, for pages (when permalinks have been activated), you may delete any
slug from the URL (except the last one of course), redirect will occur. But
if you change any slug, you'll get a 404. This is why we've introduced the
page id in page permalinks. Id won't change and is used as a base for
redirects. Works nicely (bit need some tests) and only with regular hooks !

Thx for answers.

2012/10/2 Bryan Petty <bryan at ibaku.net>

> I must have been confused with posts rather than pages by accident for
> my last tests. For posts, having tested this in 3.4.2 and 3.5-beta-1,
> any change in any slug regardless of any intermediate slug structure
> does work in every case. Even old final post slugs with completely
> arbitrary intermediate structures are redirected to the correct post.
> This doesn't always work for pages though, so maybe this is a bug that
> can be fixed in WordPress.
>
> On Tue, Oct 2, 2012 at 9:46 AM, Benjamin Lupu <benjamin.lupu at gmail.com>
> wrote:
> > - If I have the following URL :
> > http://mydomain.com/page-slug-1/page-slug-2/page-slug-3/
> > - If I change /page-slug-3/ to /page-slug-ZZZ/ in the Edit Panel, I get a
> > 404
>
> This is true, I also get a 404 in this case. This is where I think
> there might actually be a bug with pages since this works with posts.
>
> > - If I turn the URL into http://mydomain.com/page-slug-3/, a 301
> redirect
> > is done to
> http://mydomain.com/page-slug-1/page-slug-2/page-slug-3/(redirect
> > is based on the page slug). It also works if you have the
> > following URL :  http://mydomain.com/page-slug-1/page-slug-3/
> > - So we can say that reparenting is covered unless one of the slugs has
> > changed.
> > - If you change any slug (parents or the page itself) you get a 404
>
> However, this is not what I see with either 3.4.2 or 3.5-beta-1. As
> long as the final page slug remains unchanged, I can change any of the
> parent page slugs, and the old URL will be redirected to the correct
> page with the updated parent page slugs. I suspect this is just
> because WordPress only looks at the final slug, not because it's
> correctly tracking the parent page slugs, otherwise the case above
> would probably work.
>
> Regards,
> Bryan Petty
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>



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


More information about the wp-hackers mailing list