[wp-hackers] remove a category name from the internal rewrite rules?

Peter Westwood peter.westwood at ftwr.co.uk
Tue Sep 12 13:25:21 GMT 2006


On Tue, September 12, 2006 2:13 pm, Scott Plumlee wrote:
> I browsed through the support forums and thought this might be a little
> too involved for there, so I'm trying here.
>
> I use wordpress as a CMS for our site (which has worked superbly, the
> flexibility is excellent).  We run some monthly specials, and I use the
> category of 'specials' to indicate an item is on sale and to replace the
> price with the sale price along with some other trickery.
>
> I didn't realize when I set up my permalinks using categories and post
> name that I would be creating a problem.  When I add an item to the
> 'specials' category, the permalink changes because the 'specials'
> category is one of the lowest numbered categories, lower than the normal
> category of the item.  So instead of the permalink being
> '/itemcategory/itemname', it's '/specials/itemname'.
>
> I considered changing the category number of 'special' to something like
> 9999 and then resetting the auto increment setting to start at a lower
> number. But before I do that, I'm wondering if it's possible to exclude
> certain categories from the internal rewrite rules, in effect hiding
> those categories from the process that creates the permalink.  If anyone
> has another idea about how to do this, I'd be interested.

Filtering out the category is going to be nasty.

You could hack get_permalink to ignore the "special" category with a check
on the id of the category select.

Do you use the "special" category for anything but marking things as special?

Could you use post meta attributes instead - thereby using the meta
information on a post to do all the funky stuff you want to do.

westi
-- 
Peter Westwood <peter.westwood at ftwr.co.uk>
http://blog.ftwr.co.uk


More information about the wp-hackers mailing list