[wp-hackers] Ordering categories in permalinks

William Davis will.davis at gmail.com
Sat Nov 6 01:39:57 UTC 2010


Awesome, thanks Nacin. I'll give it a try.

Will



On Nov 5, 2010, at 9:37 PM, Andrew Nacin wrote:

> On Fri, Nov 5, 2010 at 8:17 PM, Otto <otto at ottodestruct.com> wrote:
>
>> What WordPress defines as the "correct" url is determined by the
>> results of get_permalink(). If you modify that, as I suggested, then
>> you are redefining what the correct URL actually is.
>
>
> According to the code in canonical.php that checks if the categories  
> in the
> URL are actually assigned to the post, they only need to be assigned  
> to the
> post to prevent a redirect, versus being what get_permalink()  
> generates. So
> if the post is actually in /business/, it shouldn't redirect to / 
> politics/
> even if WP thinks the permalink is /politics/.
>
> This is also just the code as it exists currently in trunk, at  
> least. This
> may get more specific in the future.
>
> What you need to do here is actually redefine what WordPress thinks  
> is the
> correct URL. This is not easily filterable in get_permalink(), but  
> it is
> doable. You'll note that in get_permalink(), we specifically order
> categories by ID before choosing one. Obviously you want to handle the
> ordering on your own and probably kill off category parent listing.
>
> If someone can come up with a good way to filter the various moving  
> gears
> there, patches are welcome.
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers



More information about the wp-hackers mailing list