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

Scott Plumlee wp-hackers at plumlee.org
Tue Sep 12 14:13:46 GMT 2006


Peter Westwood wrote:
> 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

Hacking the get_permalink might be the best way, hadn't thought that 
simply.  :)

I would normally use the custom fields, but the person who handles 
putting things in the specials is not technical enough to handle that 
without getting a lesson each time.


More information about the wp-hackers mailing list