Forum:Prevent addition to category

Is there a way to prevent any page from being added to a certain category? Wumbo00 (talk) 22:45, December 9, 2012 (UTC)
 * Unfortunately, no. Well, I guess you can try adding that category name to the blacklist - actually, that wouldn't work, because then if a page was already in that category, it wouldn't be possible for anyone to save that page after editing.
 * So, no. -452 19:00, December 10, 2012 (UTC)


 * The answer depends on how you add a page to a category. If it is being added directly (aka ), then you can't prevent it from showing up in the category, but you can add a category via a template (aka  ) and you can control whether the category takes effect based on conditions like page name, a parameter, etc.
 * So the answer is yes, but only if you do it a certain way. -- Fandyllic (talk &middot; contr) 10 Dec 2012 3:40 PM Pacific
 * Yes, if there is a template which is adding a category to a page, you can modify the template to only add the category conditionally.
 * I didn't interpret the question that way, but it's possible that that is what Wumbo00 is talking about, although I suspect he's more concerned with people adding random categories to pages.
 * The answer to the question asked is still "no", it's not possible to prevent a page from being added to a category. -452 00:14, December 11, 2012 (UTC)


 * It occurs to me that there is another way in which your question could be interpreted (if you've left out some details):
 * If there's a certain category that you'd like to hide from appearing at the bottom of a page, you can make the category a "hidden category" by adding __HIDDENCAT__ to the category page.
 * The page will still be listed on the category page, and will still be visible when editing the page, but the category will not appear in the category list at the bottom of the page (Although there's a user preference to show hidden categories).
 * -452 00:14, December 11, 2012 (UTC)
 * If you were really desperate, you could set up a bot that would remove the category from any page that has it except desired ones. That would be very complicated, and I don't know how one would go about doing that. Iggyvolz (Message Wall) 01:20, December 11, 2012 (UTC)
 * I'm not, but thanks. I thought about suggesting that, but it doesn't technically prevent them from being added.
 * Javascript could possibly be used to prevent a category from being added, but would likely be a TOU violation. -452 01:27, December 11, 2012 (UTC)
 * Probably your best solution would be to say "please don't" and if users add pages to the category, leave them a message telling them not to and revert their edit. I'm sure there's some MediaWiki extension you could turn on, but it's probably easiest to just tell users not to. Iggyvolz (Message Wall) 01:47, December 11, 2012 (UTC)
 * I don't need a solution. It's not my problem. -452  02:36, December 11, 2012 (UTC)
 * Actually, using a bot to clean up categories is dead easy. It's one of the most basic functions, and can be done within about a minute of installing the bot.  At least inasmuch as pywikipedia is concerned, removing categories from 100 pages takes about 13 minutes, depending on connection speed. To be honest, if he or she had a bot, the original poster wouldn't have opened this thread.  Once you demonstrate to your user base that you can wipe out their work in a flash, most won't bother with frivolous category additions.


 * Even Iggyvolz' scenario of keeping a cat on some pages, but deleting it from others, is super easy. There are some things that are complicated about bots, but category management ain't one of 'em.  Category management is one thing at which bots unquestionably excel. At the end of the day, if you've got a bot, you've got a nuke and your users have maybe a club.  In the time it takes you to write a note politely explaining why the recently-added categories are not a "best practice" on your wiki, a bot will have cleaned up most of the mess.  03:28: Tue 11 Dec 2012