RYO ‘Category Visibility’ WordPress Plugin

I needed a plugin that would display Posts only from certain categories. I found an earlier version of this plugin and modified it for my needs; then I supercharged it. Now I’m sharing it with you.

A good example of Category Visibility is this very website. It’s original purpose (in 2005) was to serve my web customers, most of whom wouldn’t have any idea how to install a plugin. I didn’t want plugin Posts to show to my regular users, but wanted to make the plugins available to other WordPress users who would want them.

See all of our WordPress Plugins

I created a WP Plugins category and unchecked “Front” and “List.” This kept these Posts off the home page, and the listing off the sidebar. (That’s all changed now. Users have a much greater understanding of plugins!)

The “WordPress Plugins” link above illustrates the point. It’s a link to the category page, which lists the plugins. You can see the category page and the associated Posts just fine. But that category did not show up in the sidebar, or on the home page. (It does now.)

This way, you could get access, in fact, anyone can search for them and find them. But they were not “out there” on the home page or in category links in the sidebar bothering my regular users.

Screenshot

RYO Category Visibility Options Page

History

I was using a WordPress plugin called Category Visibility (Keith McDuffee) which was written for WordPress 1.5.

It had a few odd points like when it filtered posts off the Home Page that was okay but it didn’t replace them; that is, if your front page was supposed to show 10 posts and two were filtered out, you’d only get eight posts. I fixed that and a few other tricky things.

It was wonderful, and lots of users agreed. Then WordPress 2.1 came out and broke everything. So I stuck with WP 2.0 for a long time.

No more! I woke in the middle of the night with an idea on how to re-think the logic and rewrite the whole thing from scratch. The new approach is more concise and takes fewer resources.

The result is faster, leaner, and, I hope, more likely to work with newer versions of WP. The same, familiar interface. Far more efficient.

Multiple categories on a post? Fine. The plugin tells WP which categories to exclude. This might not always be what you want. But it’s how it works.

There’s no upgrade path. If you’re using an older Category Visibility from one of the folks who tried to upgrade the old code, uninstall that first.

Instructions

  1. Simply download and unzip it.

  2. Put it in your plugins directory.

  3. Activate it.

  4. Go to Settings, RYO Category Visibility to see the visibility settings for all categories. the options are:

  • Front: Posts show up on the main (home) page.
  • List: Categories that will show up in the List of categories in the sidebar.
  • Search: Posts show up in search results.
  • Feed: Posts show up in the main RSS/Atom feed.
  • Archive: Posts show up in archive pages (i.e., clicking on the calendar links).
  • User Level: Numeric user level required to see these Posts.

Everything is checked to show up by default.

When you have a category to exclude from the front page, or the sidebar, etc., go to “Manage,” “Category Visibility,” and deselect the areas where you want the category to disappear.

This method is not designed as a security device, only as a display method. A guest can still access a post by post number.

Download

Download for WP 2.8+: Ver. 3.0.1.

Legacy version, WP 2.0.x: Ver. 1.0.0e. This plugin version only works in WordPress 2.0.

543 Responses to RYO ‘Category Visibility’ WordPress Plugin

  • ArChAs says:

    hi. i’m really angry with my problem. i just want to display posts in my categories.. when i click category i.e. id =4 i see only posts from this category. can you help me?

    the second problem is that my wordpress just doesn’t see my category-id.php’s files… :( look at my page.

    thanks, archas

  • ArChAs says:

    edit: i use stable version of plugin with wp 2.1. ( i think it is 2.1 ;)) and it works well. i couldnt active beta version cuz i was gettin mysql error.

  • Pingback: 从源辞典 » Blog Archive » Useful plugin for WordPress

  • Christopher says:

    Not sure if this is meant to happen or not, but when activated my category list is missing the main category li tag and heading:

    Categories

    And without it the link formatting gets kinda messed up. I may be able to hard code it in though…

  • Christopher says:

    Ok I tried adding the

    li class=categories h2 Categories /h2 /li

    bit manually and it would work if it weren’t for wordpress adding the /li before the wp_list_categories stuff, regardless of the fact it comes after it in the template code :o4a7d3d609129a9296bf7ac0608c2097

  • Pingback: Plugin para controle de categorias na página principal

  • TOMAS says:

    Quick (hopefully easy) question,

    If you hide a category from the main RSS/Atom feed, will the individual category feed still work?

    For example, if you were to hide the “content” category from your main RSS/Atom feed, would this still work?

    http://ryowebsite.com/category/content/feed/

    Thank you in advance!

  • Swen says:

    I am running into the same problem as Jeremy, but and using his workaround of changing wp_list_cats to list_cats did not make any difference. No matter what I set for visibility check box or roles, they are always invisible unless the role is 0.

    Has there been any updates or workarounds on this? Should would love to use what looks like a great tool!

  • Swen says:

    Okay, I think I found the problem. Not sure if it’s related to Role Manager or just installing WP. The user that did not work was the owner of the installation. I created a new user and gave him the role of admin. When I logged in with that account, it all worked as expected. I then tried the owner account, again and it was behaving as before, not visible when it should have been. I could not assign a role to myself in the profile manager while I was logged in as the owner, so I had to log back out and log in as the 2nd admin. I then went to set a role for the owner and I noticed it was set to admin. I changed it to subscriber and saved it. Then changed it back to admin and saved it, and now it all works for the owner, admins and subscribers, as promised!

    I’m guessing the role was not set for the owner (this is a new installation) so you may wish to test for that possibility.

    Anyway, great tool, Rich! Thanks!

    This was Beta 9 on wp 2.1.2.

  • Stephen says:

    Just some feedback. Running WordPress 2.1.2 with the beta 9 plugin.

    Everything is working fine.

    Admittedly I’m not really doing much at this point with my site. but the plugin is providing a solution to my up-to-this-point unsolvable problem.

    I’m using the Catagories to filter the main view. Because 3 of my categories are listed in my top-menu i dont want them listed in the sidebar.

    The plugin is hiding those categories from appearing redundently in the sidebar.

    Thanks for the plugin! (and here is another vote for completion of the plugin)

  • David says:

    I can report it seems to be working fine under 2.1.2.

    I do want to know if it is possible to have categories show up when browsing a category archive, but not the monthly archive. I’m wanting to use one category as an asides, which would show up separately from my main blog, but I want to not have these “aside” posts show up in the monthly archive. I currently have only Archive checked.

  • Sabo says:

    the_excerpt Reloaded and Category Visibility-RH Rev doesn´t work good together.

    And both authors stop working on these projects, it´s a shame, because they are both great plugins.

  • David T. says:

    I have just installed the beta 9 plugin. Everything appears to be working in 2.1.3. There is one thing that I would like to see with this plug-in. I have a plugin that allows me to have an upcoming events module in the sidebar of my blog. It works by having a category to which you post to for adding events. I have successfully removed that category and its posts from appearing on the main page and from the categories list on the side bar. I was also successful with this plugin to remove the posts in that category from the monthly archives. However, the calendar on the date that all the posts were made still has a link to the that day’s posts although when you click that link it takes you to a page that says “Sorry, but the page you requested was not found. Please try the “search” box, or visit the homepage.” In that way, it works because I don’t want the posts to be found in the monthly archives or by selecting the posting day on the calendar. However, I don’t think the calendar should have a link to that day’s posts, if their are no posts on that day to be seen.

    I hope I didn’t confuse anyone. If I did, I’m sorry and I can try to reword it.

  • Tony says:

    Used this with 2.1, works great. I setup a category “Index” and hid it from the sidebar list. Any post I want to display on the index.php page I assign to this category.

    Great Job!

  • Pia says:

    Just installed beta 9 and it’s working good, my only problem is this though : when you’re viewing an entry that’s either before or after a post that’s set to a “hidden” category, the previous and next link goes to that hidden post.

  • TheMystical says:

    After upgrading WP to 2.1.3 from 2.0.5 I got errors with this plugin, but thankfully the beta 9 fix all problems and is working without a glich.

    Thank you.

  • Marek says:

    I am looking for a WP 2.1+ plugin which would hide categories from the list of categories on the homepage sidebar, and from the Ultimate Tag Warrior tag cloud. Does anyone know of anything like that. I looked already for some time. Please feel free to email me to marek at megabluewave dot com. thanks Marek

  • Carla says:

    This plugin is exactly what I needed! Thanks a bunch. I have not noticed any problems so far, but I’ll let you know if any crop up. Thanks again!

  • RichadJW says:

    At the moment, the Beta9 on my WP 2.1.3 is breaking the ‘recent posts” setup Im using as part of a theme:

    I get this error message after enabling the plugin (same error message with the old version of the plugin too)

    WordPress database error: [Not unique table/alias: 'wp_post2cat'] SELECT SQL_CALC_FOUND_ROWS wp_posts.* FROM wp_posts LEFT JOIN wp_post2cat ON (wp_posts.ID = wp_post2cat.post_id) LEFT JOIN wp_catt_visibility ON (wp_post2cat.category_id = wp_catt_visibility.catt_ID) LEFT JOIN wp_post2cat ON (wp_posts.ID = wp_post2cat.post_id) WHERE 1=1 AND (post_type = ‘post’ AND (post_status = ‘publish’ OR post_status = ‘private’)) AND ((wp_catt_visibility.front=1 AND wp_catt_visibility.cv_user_level<=10) OR post_status=’static’ OR wp_catt_visibility.catt_ID IS NULL) AND category_id <> 3 ORDER BY post_date DESC LIMIT 0, 10

    While using THIS in my sidebar…

    recent posts

    <li> <a>”></a> on
    </li>

    This plugin seems to be exactly what Im looking for but I cant find the answer here in the comments after spending 45min reading – though I am glad there are plenty of people helping out! :)

    Any help would be great!

    Cheers, Richard

  • RichadJW says:

    …ah crap – it broke and dropped the recent posts code – but to paraphrase, its the posts wp code, just sorting recent posts.

    Sorry…

  • RichadJW says:

    I have also just done the whole “…sign-in and sign-out…” and different user levels and this makes no difference to the wp2.1.3 that Im using. :( Instead Im getting errors in the sidebar with recent posts (broken) and at the top of the screen as well when I log out.

    I spose the only thing to do is DOWNGRADE to a version of WP that ur plugin supports cos I NEED this plugin to work!

    Thanks! RJW

  • Farid says:

    Awesome plugin, used it pre-2.1 and loved it. Using the beta now but it will create duplicate entries on the front page blog listing for some posts.

    This isn’t happening for categories modified by the plugin.

  • Farid says:

    I just realised which entries show up twice, those that exist in more than one category which is visible. Checking the “exclusion logic” option makes 3 show up instead of 2, messy :P

  • jacob harvey says:

    I seem to be having an issue with exclusion. Actually some of the earlier comments mentioning that you can get around things like front page visibility don’t bother me. On my friend’s site I have a list of posts in a block on the front page. BUT the stuff I’m hiding, video posts, I am grabbing somewhere else explicitly. If that went away I’d have no use for the plugin.

    In any event, everything BASICALLY works, but when I turn on exclusion logic it stops grabbing the latest posts and does things descending. So the first handful of articles ever posted populate the list. Is something else going on here? I’m gonna try and manually state I want ascending in the query but I thought I should point it out in case it’s an actual bug. Thanks for the plugin! :)

  • jacob harvey says:

    Whoops, I inverted ascending and descending in my comment. I explicitly stated I wanted descending order, turned on exclusion logic, and it works now. Not sure why it was doing ascending order though…

  • josep says:

    I have tried to use the plugin in WP 2.1.3, but it has also doubled the posts of the blog, so I have gone back to the version 2.0, where it works perfectly. Problem: i can’t use the new features of the 2.1.3 version. I do not know PHP, but I observe that the problem of the duplicates is presented in those posts that share several categories. I ask for apologies for my english (this is a translation from Google).

    Thanks.

  • jacob harvey says:

    I noticed this morning that for visitors who are not logged in the issue of incorrect order shows up again. For some reason when I’m logged in the “order=” gets parsed and the posts come out in the correct order. When not logged in this is ignored and the posts come out starting with the first post (instead of the last).

    My WordPress version is 2.1.2. I’ll see if I can track down why this is happening, but naturally I’m at work and should be doing work. ;) For now I’ll just turn off exclusion logic.

    Just pulled the order= code and it’s also functioning without it as long as I’m logged in… how confusing. :)

  • David Coppit says:

    FYI, I rewrote Category Visibility into a new plugin called Category Access. It works with 2.1 and has a nicer user interface. One thing though: a user has reported an incompatibility with one or both of your Fold Category and NoSubcats plugins.

    I’ll investigate further once I have the plugins installed and am able to recreate the problem. My plugin parses the category list HTML, so if yours mucks around with it that will cause problems. For example, the user has HTML that looks like this:

    <li> This is a non-link</li>

    <ul> <li> <a href=”x” rel=”nofollow”>a sub-list with links</a></li> <li> <a href=”x” rel=”nofollow”>a sub-list with links</a></li> </ul>

    The first non-link <li> throws my plugin into a tizzy. :)</li>

  • Tahir says:

    Installed this on version 2.1.3 and it duplicates any posts that are in more than 1 category. Any idea how to fix this?

  • robertc says:

    Installed the Hidden Category plugin on wp 2.1.3 and it works great. What a beautiful piece of work.

    Question, Is there anything I can do to hide posts within the hidden category from what appears after clicking on the Manage tab. I have unchecked all boxes in the Visibility screen for the category and made user level 10.

    I’m using the delete post plugin’s move function http://archive.ashwinbihari.com/archives/2005/07/13/plugin-auto-delete-posts/ to move posts older than 24 hours to a category I call Expired Posts, then with your plugin hide them all, but I still can’t figure a way to eliminate them from view in the Manage tab screen.

    Is there anything I am doing wrong? Any ideas?

    Thank you in advance.

    Regards,

    Robert

    If you want to see what I mean I set up a test site at http://accmachine.com/test author username = Test123 temp password = bluefly

  • ingo says:

    The problem was already mentioned previously but not resolved: I have some hidden categories and I would like them to appear in the RSS feed for those people that can see the categories but not for others. If I check the Feed option and set the User Level to 2 (Author), the posts of this category still appear in the main RSS feed, even if the user does not have an account. Is this a bug or am I missing something here?

  • robertc says:

    P.S.

    In addition to above. Is there any way to have the Hidden Category also not appear within the Category Slug of any new posts as well?

    Regards,

    Robert

  • Jennifer says:

    Hi, I have spent a lot of time trying to figure your plugin out. The only thing that DOES work is when you set the user to 0. If any cat. is set to a higher number, it is not visible to anyone. I have set a few cat.s to 1 and could not see them as an administrator or any other user. Sorry, you’ve got a lot to work on.

  • Chris says:

    I installed Category Visibility 1.1.b9 today, went to the Category Visibility section and unchecked all but one of my 13 categories under Front (I only want one category to show up on the front page) Clicked save changes > view site…nothing changed. I tried unchecking a variety of categories under both Front and List…nothing changed. Everything is still visible as if the plugin wasn’t installed. Is there something I’m missing?

    The system info at the bottom spits out: PHP version: 5.2.2 MySql version: 5.0.24a-standard-log Category Visibility version: 1.1.b9 (beta 9) and it’s WP 2.1.3

  • Chris says:

    Uh, nevermind. For some reason my index page isn’t refreshing properly. Plugin seems to be working fine.

  • Lynn says:

    Hi,

    I’m getting this error: “WordPress database error: [Not unique table/alias: 'wp_post2cat']” as soon as I activate your plugin, like some other people here as well.. I use the sideblod plugin too. Any ideas?

  • Trae says:

    Bug:

    Exclusion Logic reorders the list to oldest first instead of newest first. At least in my case.

    WP 2.1.3 K2 Theme

  • Jonathan Rochkind says:

    Does this plug-in work with WP 2.2?

  • Alleymon says:

    Rich,

    Thank you so much for all your hard work with this plugin. I used a previous version with an earlier version of WP and was just what I needed. When I upgraded to WP 2.2 I worried that my favorite plugin was now broken. But you rescued me with your timely updates. I’m sure we all appreciate that you have a real job and I, for one, hope your plugin hobby is fulfilling. I’m just thankful for people like you who share your expertise and work with the rest of us hacks.

    Sincerely,

    Alleymon

  • Ryan says:

    Trae,

    That bug happens if you are using mysql 4.1.21 and is triggered by the combination of SELECT DISTINCT and ORDER BY in your query. Exclusion Logic adds DISTINCT to the query, thus triggering it.

    The real solution is to upgrade or patch mysql. A shorter term workaround is to open the plugin and edit the cv_distinct plugin. Just put // in front of the first two lines in the function (the ones thatstart with “if” and “$distinct”).

    Here is some more info about the mysql bug: http://bugs.mysql.com/bug.php?id=21456

    -Ryan

  • ms.angel says:

    I’ve been scouring the internet trying to find a way to exclude certain categories from both my front page and my feed page (although different categories). Your plugin accomplishes this perfectly! Thank you so much!

  • infernor says:

    I have installed it in my blog. thanks for your job!

  • P.Hedges says:

    Installed this on 2.2 and it is working fine. Thanks for the great plugin.

  • Nifty says:

    I have installed it in my blogs and hide categories for show on index page. Thanks.

  • Trisha says:

    I installed this on 2.2. It works well with hiding content. But even after users log in, they cannot read the content. Could you please help?

  • Mark says:

    Work’s fine with 2.2.

    @ Trisha:

    Try something with the Userlevel. My Userlevel is 0 everywhere.

  • Victoria says:

    I installed on 2.2 and it appears to work great with one exception. I am using the Category widget and now it also leaves out the excluded categories. I have everything set to show in list and level 0.

  • Andrew says:

    This is a great plug-in! 1.0.0e with WordPress 2.2.1 I’m really only using it to completely hide one post, but I seem to have a small bug. Whenever I put posts in more than one category, they show up in multiple copies on the front page. Two categories = two posts . three categories = 3 posts and so on. If I deactivate the plugin, the problem goes away. Anyone else have this problem?

  • Ajani says:

    This ought to be part of the WP core… Fantastic!

  • Stevan says:

    I’ve installed beta 9 (WP is 2.2) and all works fine except for the posts from the hidden category still appearing in Recent Posts.

    Is there a fix for this?

    Thanks, Stevan

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>