‘Category Visibility’ Plugin for WordPress 2.0.x

‘Category Visibility’ Plugin for WordPress 2.0.x



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; now I’m sharing it with you.

A good example of Category Visibility is this very website. It’s purpose is 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 keeps the Pages off the home page, and the listing off the sidebar.

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 does not show up in the sidebar, or on the home page.

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

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 changed that to run a select that does the filtering; as a result you get the full 10 posts.

There were a few other tricky things.

  • With WordPress 2.0, user levels are diminished and replaced with Roles. In some ways, this is better. If you’re not using any other old plugins which require numeric user levels, you have even more control. Use Owen Winkler’s Role Manager Makes it easy to add Roles and change the user level number associated with a role. Then use Category Visibility to control what those users see. A numeric code makes it possible to add permission to more than one user Role with a single entry.

  • Return category archives when called by cat ID. the original author must have used permalinks, because it wouldn’t work without permalinks. And there was some kind of problem if you had the category as part of the permalink. I’m pretty sure that’s been resolved.

  • Handle empty entries, that is, categories where no Category Visibility rule has been set. If you set up a new Category, you had to go to Category Visibility to set the user level, or it wouldn’t show. Now, that’s not required. By default, categories are visible to all.

  • CV was excluding Pages from search results when the Page was associated with a Category which was not supposed to be visible (Uncategorized). Since Pages aren’t really part of the Post/Category system, we don’t want them excluded, so I fixed that.

  • Allow administration only to those who have a Role that can Manage Categories.

  • Upgrade from the older WP 1.5 Category Visibility (0.31 by McDuffee). If you upgrade, be sure to deactivate the old plugin, then activate the new one, to initiate required changes to the database. You’ll also need to reset the visibility choices; this new version uses an entirely different table, purely to allow you to step back to Keith’s version if you prefer.

This plugin only works in WordPress 2.0. (Currently not compatible with 2.1.)

Instructions

  1. Simply download and unzip it.

  2. Put it in your plugins directory.

  3. Activate it.

  4. Go to “Manage,” “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 links (i.e., clicking on the calendar links)

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

Latest version, WP 2.0.x: Ver. 1.0.0e.

  • Added a function, cv_get_posts(visibleto), which duplicates the WordPress get_posts() function except that when a category is not passed, it returns posts in visible categories only. Defaults to those visible in ‘list,’ but can be changed using the ‘visibleto’ parameter.

A 2.1/2.2+ version that might work for you? Due to the urging of early adopters, I hacked at the catvis system to see if I can get it to work with 2.1. Here’s an early copy. It won’t hurt anything. But, from the comments I received, it probably won’t do the job. (I use WP 2.0.) MySql 4.1 no longer required for standard use. Download Beta9.

Some folks had suggestions, which I incorporated into Beta 10. Download Beta10.

One user has updated this for 2.3. (I haven’t tested this because I have NO 2.3 systems. Check:
http://www.tastycornbread.com/category-plugin/.

Alas, everyone wants to know when the new version will be ready. It probably won’t. As I was testing the 2.1 version WP released 2.2 and I realized I can’t keep up. Still, some folks are finding this very useful, so I’ll keep it here for you and maybe someone else will pick up the ball.


384 Responses to “‘Category Visibility’ Plugin for WordPress 2.0.x”

  1. Balaji Dutt Says:

    Hi,

    I was trying to get the Private Categories 2 plugin to work on my site, but it kept breaking in IE.

    Found your plugin through a search and it works like a charm!

    Great work and thanks!

  2. Luis Says:

    Thanks, it seems the original author has dropped this project. Your work is very much appreciated.

  3. Luis Says:

    Update: I found a bug.

    You need to add support for child categories. That is, categories that are made under a parent.

    If you get that fixed it is perfect.

  4. maira Says:

    Thanks a lot for updating this essential plugin!!! I was starting to be afraid that I’d have to rebuild my whole site until I read your message at gudlyff’s.

    And many thanks also for your improvements, specially for the default visibility for new categories.

    Maira

  5. Rich Says:

    Thanks, all.

    Luis, caught the child cat bug. (Would a child cat be a kitten?) Squished the bug and uploaded v. 1.0.0a.

    Maira, thanks. That drove me nuts. Also, when you’d set up a new system and activated the plugin everything was fouled up til you went in and initialized the database. Now it’s created when you activate the plugin.

    Rich

  6. Rich Says:

    Category Visibility seemed to be creating a lot of mysql queries, so I modified it a bit to cache results and it made a difference. In my somewhat high-overhead theme it reduced the query count by about 18, which I consider significant.

    So, if you want a Category Visibility that runs faster, download 1.0.0b.

    Rich

  7. Martin Says:

    Great! I also ran into the Filter problem with Keith’s plugin. This one worked as a out of the box replacement.

    THX
    Martin

  8. Rena Says:

    Thanks for carrying on with this plugin. It’s of definite value.

    Any chance you’ll add support for turning on/off visibility of pages for wordpressers using list_pages or wp_list_pages in their sidebar. It would be great not to have to muck around in code in order to display/exclude particular pages.

    Thanks!

  9. Rich Says:

    Rena,

    About “..support for turning on/off visibility of pages for wordpressers using list_pages or wp_list_pages in their sidebar…”

    I think that would be a different animal. (Not a catt plugin.) You’d have to check for a specific custom field or template to exclude the Page from the list.

  10. oneunshamed Says:

    found another bug.

    When you have multiple loops set up on your front page, your plugin does not just kill the category from showing up in main loop, it kills them from showing up in any loop on the front page.

    one plugin i found that avoided this was: RumCategory,
    however, it is not nearly as robust as this one, therefore i would hope that you could arrange it to only kill the main loop in index.php

  11. oneunshamed Says:

    Upon further inspection, i have found that this issue is only created when making the “archive” invisible, all of the other options behave as they should when un-ticked.

    The solution is in somehow allowing users to hide posts from the archive, without completley eliminating the category all together (which is what the plugin in is seemingly doing ).

  12. Rich Says:

    Well, we could debate whether or not that’s a bug, but that would serve no clear purpose.

    It’s our intention that when you uncheck something off the front page, that it is, in fact, off the front page.

    The ‘list’ is supposed to refer to the sidebar.

    We run two loops on many of our fromt pages, the first is the main loop, the second is an “additional headlines” loop. We expect excluded categories to be excluded there, too.

    I can understand that there might be cases where you’d want something else. You’d probably need to modify your index.php to set some kind of a a flag and modify the Category Visibility plugin to not react when the flag is set.

    Now it just recognizes that it’s the home page (through a process of elimination) and works accordingly.

    About the archives business, that has created a number of perplexing situations. We’ve somehow fixed most of them, but a few persist. I’ll probably go look at that sometime; can’t promise when.

    Note that there’s a little internal function in there now called cv_visible_cats(). It takes one parameter, a string that says front, list, seach, feed, or archives, defaulting to front. This returns an array of categories visible to the respective area.

    It might be possible to use that for special purposes; we do that.

    // cats visible to front page
    $acats = cv_visible_cats('front');
    $catlist = '';
    foreach ($acats as $category) {
    $catlist .= ' ' . $category->cat_ID;
    }

  13. oneunshamed Says:

    hmm, not quite sure if i know how to implement that the right way, however i have used this in conjuction with your plugin by not hiding anything from the archives in your UI, and then going in and hiding them manually in my index.php

    here is a sample of my code:

    < ?php if (is_category()) { ?>
    <h2>< ?php _e(’Archive for’); ?> < ?php echo single_cat_title(); ?>

    < ?php } elseif (is_month()) {

    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts("paged=$paged&cat=0,1,2,3,4,5,6,7,8,9,10,11"); ?>

    <h2>< ?php _e('Archive for'); ?> < ?php the_time('F, Y'); ?>

    basically i am telling wordpress what categories to show at any given time, whatever category numbers arent listed above, are not displayed. This however is a hassle, so please fix yours :P

    hope this helps

  14. Steph Says:

    When the plugin is activated, and i turn off certain categories from the archives it still displays the months where the certain categories are but then when the months are clicked on it says the page you are looking for is not there. Is there a way to make the month not be displayed if the category is turned off?

  15. Mike Evangelist Says:

    Great plug-in! Thanks.

    I think I’ve found a problem though; I have a category with a apostrophe in its name: ‘Jobs I’ve Known’. With the plug-in operational that category does not show up in the sidebar (even though all the checkboxes are ‘on’). If I edit the category name to remove the apostrophe, the category appears correctly. Any way around this?

    Mike

  16. Kathy Moore Says:

    Thank you so much!

  17. Rick Says:

    Awesome!

    Thanks Rich, just about perfect. What would be great is to have a ‘per post’ option. Meaning that when I write my post I can set whether I want it on the front page or not (but still have it publish to cats). There is something similar to this in mambo/joomla.

    Thanks anyway. Great plugin, easy to use!

    Rick.

  18. shelbinator Says:

    Excellent plugin!
    However - for those of us looking for extra discretion, it would be even more excellent if there was a way to turn off visibility in the calendar as well. I have a test category “invisible” and deselected all of the visibility options for it, but the post I just wrote in that category still causes that day (today, 6/15) on the calendar to become a link, and a mouseover shows the title of the post. Just a thought for any future revision - suggestions for a hack welcome. :-)

  19. JP Says:

    This is very sweet. I was wracking my brain (and the support forums) trying to figure this out until someone linked me here. I haven’t implemented it yet, but just reading, it’s exactly what I was looking for. Keep me posted of any updates!

  20. JP Says:

    D’oh! I just installed it, and as I was doing so I thought to myslef “hmmm, I wonder if this is going to work with Sideblog 2.0 (By Kates Gasis)” and sure enough, it doesn’t. Had both activated and it snafu’d on yours, deactivated Sideblog and the main page works but now no ‘updates’ sideblog in the sidebar. Any thoughts?

  21. Rich Says:

    It doesn’t work well with Sideblog.

  22. Yoyo Says:

    I don’t use sideblog, but I get the following error using Ver. 1.0.0c on WP 2.0.3:

    WordPress database error: [Not unique table/alias: 'wp_post2cat']
    SELECT DISTINCT * 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_date_gmt <= '2006-06-17 09:52:59' AND (post_status = "publish" OR post_author = 1 AND post_status != 'draft' AND post_status != 'static') AND post_status != "attachment" 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 = 2) AND (post_end_date >= '2006-06-17 23:59:59' OR post_end_date IS NULL) GROUP BY wp_posts.ID ORDER BY post_date DESC LIMIT 0, 6

    Any ideas what is going on? All I need to do is NOT allow a couple of my categories in the main blog RSS feeds.

  23. Rich Says:

    Yoyo, you’ve got the same problem as JP with Sideblog, something’s combining the calls so you end up with two LEFT JOIN wp_post2cat statements in the join portion of the query.

    It’s probably some other plugin that adds the second LEFT JOIN without checking that one’s already been put into play. (In CatVis we check that before adding the join.)

  24. ZMAng Says:

    Hi, thanks for the great plugin. However, it doesn’t seem to work when multiple categories are assigned to a post (e.g. one removed from index page, while another is not).

    Is there any way so that a post can be removed from the front page as long as one of its categories has been set as invisible?

    Thanks in advance.

  25. Rich Says:

    Alas, this is one major flaw with the visibility issue… one I hope to have time to tackle sometime.

    In fact, there’s more to it than that.

    Some folks, like you, think a post shouldn’t appear if ANY category is set to invisible, and others think it should be visible if ANY category would make it visible.

    I happen to fall in the latter group.

    Suppose you have a post that’s appropriate for “members” and for “evaluators.”

    You’d want it to appear for evaluators even if members was restricted from the home page. Or sidebar list. Or whatever. Well, that’s what I’d think.

    But, as it is, mysql picks one and uses that. So with multiple categories, anything can happen.

    Sorry about that.

  26. Dave Says:

    Brilliant!!!! I’ve been trying to solve this problem for days, was pointed to your plugin and voila. Done in 5 seconds. Peace, Love and Plug-ins!

  27. Keith Allen Says:

    Thank you. This is excellent work and should be referenced on the WP website for plugins. Had to search for a couple of hours and even install the original version before finding this one. I have an “Opinion” catagory, where I like to vent once in a while, but I don’t want to force people to read it when they first hit my page (only if they really want to subject themselves to my point of view).

    Thanks again for all the time you spent developing this and making it available for everyone.

  28. Kelvin Wong Says:

    I am using K2 and widgets plugin for the sidebar and I also have your plugin activated.

    When I click a catergory at the sidebar, I get the following error:

    [Unknown table ‘wp_post2cat’ in on clause]
    SELECT DISTINCT * FROM wp_posts LEFT JOIN wp_catt_visibility ON (wp_post2cat.category_id = wp_catt_visibility.catt_ID) WHERE 1=1 AND post_date_gmt <= ‘2006-06-26 00:57:59′ AND (post_status = “publish” OR post_author = 2 AND post_status != ‘draft’ AND post_status != ’static’) AND post_status != “attachment” AND ((wp_catt_visibility.archives=1 AND wp_catt_visibility.cv_user_level<=10) OR post_status=’static’ OR wp_catt_visibility.catt_ID IS NULL) GROUP BY wp_posts.ID ORDER BY post_date DESC LIMIT 0, 5

    When I turn off your plugin.. everything goes back to normal. Any advise?

    Thanks

  29. Rich Says:

    Kelvin, I think version c will help… download it!

  30. Matthew Wayne Selznick Says:

    Works like a charm! I needed a solution like this… a five second google search, a ten second read of some WP Forum posts, a quick download, a quick install… it took less than five minutes to have a problem, find a solution, install it, and have the problem solved.

    Days like this, I really love the internet — and folks like you, who create plugins and offer them for free to the community. Great job.

  31. Kelvin Wong Says:

    Rich, thanks for the tip, the c version works!

  32. lausse Says:

    there are some issues with David Coppits Category Order (http://www.coppit.org/code/) This will keep on working, whilie his hide all the cats if this is installed.

  33. John Says:

    Just like everyone else said, this solved a problem I had been pulling my hair out about for hours - excluding more than one category from the front page with “query posts” is more difficult than it has to be!

    But this is even better. Thanks!

  34. Rick Says:

    This plugin is great :) But I’m wondering if it’s possible to still show a hidden category in a seperate section of the page ie. I have two loops running, one for a devoted category, dont want to kill it all together.

  35. Marcus Says:

    Great plugin. One minor problem - it doesn’t hide the posts in my sidebar. I have created a “privatetest” post allocated to a “private” category to test and this post doesn’t appear on the home page, but does appear in the sidebar.

    My sidebar code is below:

    Recent Posts

    <ul class="posts">
    <?php BX_get_recent_posts($p,20); ?>
    <A href="http://www.marcuscake.com/sitemap/">View all posts (sitemap)</a>
    </ul>

    I suspect the BX_get_recent_posts function may not be typical.

    The following is from the BX_functions.php file:

    function BX_get_recent_posts($current_id, $limit)
    {
    global $wpdb;
    $posts = $wpdb->get_results(
    "SELECT ID, post_title FROM "
    . $wpdb->posts . " WHERE post_status='publish'
    AND post_category=='17' ORDER BY post_date DESC LIMIT " . $limit);
    foreach ($posts as $post) {
    $post_title = stripslashes($post->post_title);
    $permalink = get_permalink($post->ID);
    if ($post->ID != $current_id) echo "<li><a>" . $post_title . "</a></li>\n";
    }
    }

    Can anyone make any suggestions? Thanks for your help in advance.

  36. hikka10 Says:

    Just as info:
    I also had the conflicet with two LEFT JOIN.
    Did a disable of the plugin ‘Front Page Categories’ (ok plugin, but manual edit in php file).

    Very fine plugin you made here.
    Regards

  37. jonathan Says:

    gracias justo lo que estaba buscando!!

  38. Elena Says:

    Excellent! Worked like a charm. :)

  39. Franco Says:

    I’m using your plugin. But all the posts in the hided category appears in the rss feed, and you can read all that posts with a direct link.

  40. Florian Says:

    Hi,

    I’ve got the same problem. The category is hided, but in the rss feed the post appears-

    is there any fix for that problem?

  41. hadi farnoud Says:

    i have same problem with sideblog, i realy need both (sideblog and catvis) what can i do?

  42. Rich Says:

    Franco and Florian, when I uncheck “Feed” the stories disappear from the RSS feed. If you’re not getting that behavior, it must be due to some other plugin or modification on your system.

    Hadi, sorry, we have no solution here for plugins that don’t use the standard hooks.

  43. Jn Says:

    Woohoo! Worked like a charm! Nothing can describe my relieve now. Heh heh… until it breaks (have not checked the feeds, search, etc.), of course. =P

    Well done!

    • WP 2.0.3
  44. Jn Says:

    Oh, just one problem.

    If some smart alec did something like http://myblog.com/category/private , apparently all the private entries will appear. Any idea?

    Cheers!

  45. Upekshapriya Says:

    Hi Rich

    Just wondering if this Category Visibility plugin can be made to work with Subscribe2 plugin - what I need to happen is the list of categories in the subscription page to be restricted by the level of the user, as would happen anywhere else on the site, but not in the admin panel it seems.

    To be more general - I want to be able to restrict the categories shown to a user even in the admin panel. Is this at all possible?

  46. Rich Says:

    Upekshapriya, you might try editing the source code. As it is, the admin panel gets everything.

    CatVis has never been a “security” feature, actually, more of a “display appropriate material” kind of thing.

    That said, in version c, around line 205, are a couple of lines that you might try commenting out.

  47. Upekshapriya Says:

    Just discovered that neither version seems to be working on a post in a category that’s restricted to user level 10 under a couple of conditions (when logged out completely).

    The post is shown in the sidebar when I list the titles of the latest posts with wp_get_archives(’type=postbypost&limit=5′)

    Using the permalink to the post provided by above condition the post shows fine on its own.

    Thought that might interest you

  48. Upekshapriya Says:

    Rich, sorry I didn’t see you post before I wrote the next one.

    Tried what you suggested in commenting out lines 205 and 206 to no effect. Also commented out 189 which had the same reference. This didn’t work either (ie all these lines were commented out). Maybe it’s a lot more complicated to do it?

  49. Jean Says:

    Hi Rich,

    Oh, I forgot to mention that I was using v1.0.0c that allowed readers to key in the URL http://myblog.org/category/private to read all the posts in what apparently is a private category.

    However, it seems that v1.0.0b didn’t have this problem. When readers tried something like that above, they have a page not found response, which is perfect.

    May I know which is the expected behavior?

    Cheers!

  50. Mario Says:

    Hi Rich,

    Thanks for the plugin. Works very well until I use it with Category Order v1.9.4 by david Coppit. Not only do I need to hide a category from the side bar, but I need to put them in a specific order.

    Andy ideas?

    Best regards!

  51. Zjaak Says:

    Hi, when I exclude certain categories (from the frontpage, archives - everything), I can still see the posts when using the tag “get_archives”. I guess this exclusion only works in the real archives page? Too bad.

  52. Linda K Says:

    Hi there, thanks for the plugin. Very useful, however it behaves strangely when I try to display an unordered indented list of my categories, subcategories and sub-subcategories. The first category displays in bold as intended, however every other category acts as if it is a subcategory of the first one ….
    Tried both versions of the plugin and they both do the same thing ..
    Hope you can help,
    cheers.

  53. Linda K Says:

    Have found a fix for my problem, a bit clunky perhaps, but it works for 2 levels of subcategories:
    At line 322, change the part of the for each statement as follows:

    foreach ($linklist as $link) {
    if(preg_match("/class.children/”, $link)) {
    $children = 1;
    $newlist .= $link;
    } elseif(preg_match(”/class.
    children/”, $link) && ($children=1)) {
    $children = 2;
    $newlist .= $link;
    } elseif(preg_match(”/<\/ul>/”, $link) && ($children=1)) {
    $children = 0;
    $newlist .= $link;
    } elseif(preg_match(”/<\/ul>/”, $link) && ($children=2)) {
    $children = 1;
    $newlist .= $link;
    } else { ….. (ETC)

  54. sven Says:

    wonderful. Definitely try to get this to be a default included feature for wordpress !!

  55. Guillermo Says:

    When I activate the “category order plugins” and “category visibility” the category doesnt appear…
    This could be fixed? Thenks…

  56. Alok Says:

    pretty slick, but wanted to know if I can setup a way in which certain categories show up on certain pages only. For eg. If I have a category called News, can I get it to appear only on the ‘News’ Page? I checked the wordpress forums, but the code wasn’t quite helpful [ noob to php ], so some1 asked me to check out your plugin. Would really appriciate help in any extent possible.

  57. Rich Says:

    Alok,

    No, this won’t do that.

    What you describe, well, that’s what WordPress category pages are, pages which display only posts for the specific category, i.e., yourdomain.com/?cat=5

  58. Nawaaz Says:

    Hi Rich -

    I see that typing in the permalink of a post as the URL causes the post to be displayed even if the category it belongs to is not visible to the user. Is this the expected behaviour? I am using wp2.0.3 and I checked both the b and c versions of your plugin.

    Not sure how this happens since the loop in single.php (to display the single post) is similar to the loop in the main index template (if (have_posts()): while (have_posts()): the_post(); … ). Does this mean the filters you are adding to posts_join and posts_where are somehow not being called for the single post?

    Any clarification would be very helpful. Thanks!

  59. Rich Says:

    Yep, Nawaaz,

    It’s not a security plugin, it’s just designed to control what shows up on front page, sidebar, etc.

    You’d be correct in a need to understanding how single posts are called… especially with permalinks.

  60. Guillermo Says:

    Hi Rich, im having a problem with calendar (or archive) links. They give me a “404 not found”, but they work if i deactivate the plugin. Im using the 1.0.0c with permlinks. And i have the right configuration in your plugin (actually, i have the the visibility on for all options).
    What could be happening?

    PD. Sorry for my english :(

  61. Rich Says:

    Guillermo,

    In the sidebar, you’ll see archives listed that have articles, but when you click the link you’ll get a 404 if all the posts for that month are in categories which have archive unchecked.

    Recheck “archive” and the posts should show up.

  62. Guillermo Says:

    …And it works!!! I feel so lame!!! Thank you very much specially for your fast response!!!

  63. Rich Says:

    Guillermo,

    It works, but it’s not ideal. Maybe someday I’ll come across the reason an archive with only invisible category posts shows up in the sidebar. (I’m not using Archives in any of my websites, so it’s never been an issue for me.)

    ‘Til then, don’t feel lame, the plugin is lame in this instance.

  64. Karl Says:

    I noticed that this plugin has a conflict with the Sideblog Wordpress Plugin tht can be found here,

    http://katesgasis.com/2005/10/24/sideblog/

    Just wondering if that could be solved somehow.

  65. GD Says:

    hey rich, im having a problem.. its showing the hidden posts under my blog’s recent posts list on the right side of my page.. so ppl can still acess that post.. how do u get it to not show up on that menu?

  66. Rich Says:

    GD,

    Well, yes, that can be a problem, because WP’s get_posts() function pays no attention to this. I just posted a new version, 1.0.0d, which adds a replacement function, cv_get_posts().

    This may also be the problem others have had with other non-compliant plugins.

    Then you can use a function like this for Recent Posts:


    function ryo_recent_posts($no_posts = 5,
    $before = '<li>', $after = '</li>',
    $skip_posts = 0, $cat = 0) {
    if (function_exists('cv_get_posts')) {
    $posts = cv_get_posts('numberposts='.$no_posts.
    '&offset='.$skip_posts.'&category='.$cat);
    } else {
    $posts = get_posts('numberposts='.$no_posts.
    '&offset='.$skip_posts.'&category='.$cat);
    }
    $output = '';
    if ($posts) {
    foreach ($posts as $post) {
    $post_title = strip_tags(stripslashes($post->post_title));
    $permalink = get_permalink($post->ID);
    $output .= $before . '<a href="' . $permalink .
    '" rel="bookmark" title="Link: ' . $post_title .
    '">' . $post_title . '</a>' . $after . "\n";
    }
    }
    echo $output;
    }

  67. GD Says:

    thanks!

  68. Albertojm Says:

    i have a problem, when i post an entry in two categories (example
    “sports”: normal category, not affected by the plugin.
    “other category”: set up for not showing the entry in the main/front page.

    the entry still appears in the main/front page.
    ¿it’s any way to fix this?

  69. Rich Says:

    Albertojm,

    See my comment of June 17, 2006, above.

  70. Thais Says:

    hi,
    thanks for your plugin!

    there is a way to show how many posts are “visible” in front page after using this plugin?

    (sorry for my terrible english!)
    thais

  71. Rich Says:

    In the loop, you can use count($posts) to get the number.

  72. Thais Says:

    thanks!!

  73. Sven Says:

    hi,

    As said, great plugin. However, having an option to filter hidden posts out of the main page (I know they dont show up directly on main page, but when I click a post on main page, hidden posts are shown as next/previous) - and - to disable direct links to hidden posts would be really nice.
    I know this wasnt supposed to be a security plugin. However, for simple applications (like mine ;) ) these options would make it one.

    I just started a page for a kindergarden, and I simply want some contents to be completely hidden from unregistered/low level users, while I dont want to bother registered users with an additional password entry or even a browser login dialog for secured content.

    Don´t you think, adding the two hide Options “Direct” and “Loop” (or whatever they would be called) would be a welcomed improvement to the plugin?

    Kind Regards,
    Sven

  74. Sven Says:

    Would do add this myself, but, unfortunately I haven´t the slightest knowledge in php right now (might change sometime ;-) )

    Regards again,
    Sven

  75. TedFox Says:

    I know this is a little advanced.

    but testing this plugin with wordpress 2.1, when a post has multiple categories, it’ll appear in the loop multiple times.

    for e.g. if a post has 3 categories, it’ll appear 3 times in a loop

    Any suggestions on where I should be looking to solve the problem?

  76. Rich Says:

    I don’t have that problem in 2.0.4.

    Multiple categories ARE a problem, however.

    The first challenge is deciding what you want it to do.

    - Show ‘em if ANY category is visible.

    - Don’t show ‘em if ANY category is blocked.

    Frankly, there are contradictory, yet logical and valid, answers.

    Then comes the challenge with getting the code to work.

    See comment by ZMang and my response on June 17.

  77. Luc Feenstra Says:

    ok i downloaded this plugin,i got the category not to show on home but how do i get it so it shows on another page?

  78. Greg Says:

    Thanks for the great plug-in. Just what I needed.

  79. visaap Says:

    Like Luc I’ve got the same thing. All my categories that have private posts in them won’t appear in de wp_list_cats I would like to trigger my vistors on subscribing by showing them all the categories I have. As soon as they open the categorie (with private posts in it) the will be confronted with the log in/register page.
    How do we un-hide the categories?

    P.S.: It is a great plug-in!

  80. Dave Says:

    Great Plugin, just what I’ve been looking for.

    I’m using it to filter the monthly archives down to showing the contents of just one category: however, there’s some functionality I’m not sure how to implement here.

    Imagine I’m filtering to just show category A, and my site has two categories, A and B.

    If I post in december to category A and category B, and in january post only to catogory B, my monthly archive list shows as:

    DECEMBER
    JANUARY

    even though, with category B filtered out, it should show

    DECEMBER

    only, as January’s posts are all in the filtered category B. However, the standard wordpress call of wp_get_archives() doesn’t care. Does anyone have any idea of a workaround for this?

  81. A Pseudo-Tutorial On Inline Asides | Open Switch Says:

    […] As a last step I wanted to remove the “asides” category from showing up in my feed. I did this for several reasons but mostly because it’s what Kottke does and darn it, I wanted to do it too. Instead of more hacking — which I was tired of at this point — I just found a nice simple plugin and let it do the work for me. […]

  82. Danny Castillo Says:

    I downloaded the lastest version. I this error with 1.0.0b also.

    WordPress database error: [Not unique table/alias: ‘dc_post2cat’]
    SELECT DISTINCT * FROM dc_posts LEFT JOIN dc_post2cat ON (dc_posts.ID = dc_post2cat.post_id) LEFT JOIN dc_catt_visibility ON (dc_post2cat.category_id = dc_catt_visibility.catt_ID) LEFT JOIN dc_post2cat ON ( dc_posts.ID = dc_post2cat.post_id) WHERE 1=1 AND post_date_gmt <= ‘2006-11-07 04:22:59′ AND (post_status = “publish” OR post_author = 1 AND post_status != ‘draft’ AND post_status != ’static’) AND post_status != “attachment” AND ((dc_catt_visibility.front=1 AND dc_catt_visibility.cv_user_level<=10) OR post_status=’static’ OR dc_catt_visibility.catt_ID IS NULL) GROUP BY dc_posts.ID ORDER BY post_date DESC LIMIT 0, 10

    I am not sure whats happening. any help would be get. Thanks

  83. Rich Says:

    Danny,

    You’re getting two LEFT JOIN dc_post2cat statements which means you’re using another plugin that doesn’t protect against that occuring.

    CatVis is running first and adding the needed phrase, then the other plugin is running and adding a dc_post2cat join also.

    CatVis checks for this conflict before adding the join to the join phrase, but it can’t keep another plugin from adding it later.

    Try turning off other plugins, one at a time, to catch the culprit.

  84. Rupen Says:

    Hey there,

    I downloaded the plug-in, but I seem to be having issues. As soon as I activate the plug-in, all my categories disappear from the sidebar. This is the code on the sidebar to call the categories:

    Categories

    As soon as the plugin is activated.. BAM.. that gets removed even though all the boxes are checked and user level = 0

  85. Rich Says:

    Rupen,

    Change the code in the sidebar to read

    wp_list_cats('sort_column=name');

  86. Ralf Says:

    This is a very usefull plugin. Thanks for sharing it. I would have one wish, though: Could you please modify the plugin to show the names of the roles (subscriber, editor, admin, custom roles made with RoleManager) instead of numeric levels?

    I guess - without studying code - that the fact that several role names can be assigned to the same numeric id might lead to the need of more extensive changes… but I am just looking for a nicer user experience, so perheaps substituting a role name list for the id would be sufficient…

  87. Rich Says:

    Ralf,

    The role names, with associated numbers, are shown at the bottom of the Category Visibility management page, just above the “Submit Changes” button.

  88. Moshav HaAm Lab » Blog Archive » WordPress Category Visability Hack Says:

    […] Rich Hamilton’s revision of Keith McDuffee’s original “Category Visability” is an excellent WP plug-in. It just doesn’t quite work the way I needed for the main Moshav HaAm site, which has relatively sophisticated needs for layers of content access, given our mandate to be as open as possible to a number of different valences of community and leadership. […]

  89. Giofilo Says:

    Hi, I have activated the plugin, but it give me a problem. In the home page there is this text:

    Catchable fatal error: Object of class wpdb could
    not be converted to string in
    C:\wamp\www\giofilo.com\wordpress\wp-content\plugins\category_vis-rh.php
    on line 212

    Sorry for my bad english,
    Thanks

  90. Joel Rothschild Says:

    First, thanks to Rich for a great plug-in! I can’t tell you how much easier it has made an otherwise difficult week.

    Second, for those who (like myself) need different logic for the case of multiple-category posts, I have a working hack of Rich’s plug-in here. I reworked the database implementation so that a post will now be invisible if any of its associated categories are invisible for the current user. I also added the option of hiding posts from single-page view, and I made minimum user-level settings specific to each display area for a category rather than general to the entire category.

    Use my version at your own risk. I’m using it in one project that is still in development. So far so good, but I’m no expert at WordPress architecture and I haven’t tested it very rigorously yet. If you do use it, please share your experiences with me. I suppose I most need to know whether it breaks; though it’s always more fun to hear about how it made your day brighter, teeth whiter, and children smarter. %)

  91. Giofilo Says:

    What I have to do for resolve this problem?

  92. Rupen Says:

    Okay,

    This is an AWESOME plug-in, but I am still an amateur in this whole thing. I am using category templates and I am implementing specific sidebars. I am having trouble coming up with a code to list the parent Category 12 with the children of that same category.

    Any recommendations?!

  93. gerld Says:

    ive tried this and when i click on a single post, using the previous and next links, it still allows me to see the category that i’ve marked hidden.

    any ideas??

  94. gerld Says:

    also, is there any workaround to show the hidden category on other sections of the site?

    this whole wordpress category thing is really driving me insane. do you have any ideas on displaying the hidden category on a sidebar or something? ive tried this, but it doesnt work (i just get a blank page.. meaning php error?)

    <ul>
    <li><a></a> --- </li>
    </ul>

  95. Chin Says:

    Nice plugin, but it have some bug. If user will put url to browser by hand, he can see hidden post.
    For example - visit my site page http://chingiz.org/archives/15
    You can’t find this page from main or others menu, but if you will see to the numbers of public topics, you can find some numbers of hidden post.
    If you plase that numbers after /archives/ - you’ll see “secret” post. At this time i hide content from hiddeh posts by other plugin :(
    Headers of hidden posts anyway can see anybody.
    Please, correct this. And then your plug-in will be the best for hidden zones and posts in WP blogs :)

  96. Chin Says:

    Hey, guyz, i see Joel Rothschild did what i want for upgrade this plugin. Nice work! Single pages now are really invisible! It’s working.
    Thank’s for Rich and Joel Rothschild :)

  97. L Says:

    how does the cv_get_posts() works? im using the function i tried to replaced it with cv_get_posts but it tells me is missing arguement error?

    Thanks in advance

  98. L Says:

    Oops sorry for the incomplete question.

    How does the cv_get_posts() works? im using the function

    get_archives('postbypost', 12);

    i tried to replaced it with cv_get_posts but it tells me is missing arguement error?

  99. Rich Says:

    L,

    cv_get_posts() is similar to the WordPress template tag get_posts() function except that when a category is not passed, it returns posts in visible categories only.

    It would not be a replacement for get_archives().

    You can check get_posts() at

    http://codex.wordpress.org/Template_Tags/get_posts

    The visibleto argument is added, defaulting to list

  100. Erum Says:

    Hi,

    Great plugin. Exactly what I needed! Thanx so much!

    There is one thing I noticed…when I unclick archives for say Category C. Now it disappears off the archives and the front page which is great. However, when I go directly to the category page, it doesn’t show any posts either. Seems like the posts just disappear. As soon as I click Archives back on, the category C page starts showing the categories again.

    Am I doing something wrong?

  101. Ayerst Says:

    Great Plugin, worked like a charm.

  102. Rich Says:

    Erum,

    You’re not doing anything wrong. Category pages are treated the same as archive pages by this plugin.

    While that doesn’t affect me like it does you, it’s not ideal, so maybe I’ll do something about that next time I update.

    You could go about line 253 and comment out the lines that read:

    elseif (is_category())
    $where .= " AND (($cat_visibility.archives=1 AND $lc";

    To comment these out just add // at the beginning of each line.

    That should work by allowing category posts to appear on category pages.

  103. Mike Murray Says:

    Bear with me.

    I am combining three Blogger blogs and a LiveJournal into one WordPress blog on my website. I assigned the two subsidiary Blogger blogs as categories in the WordPress blog.

    I want to present a peek into each of the original blogs on my homepage which I was able to accomplish with “feed2js”. However, after changing feed visibility on the two subsidiary categories, they disappeared not only from the main RSS feed, but apparently there is no category feed as well.

    Does eliminating visibility of a category removed it from all feeds or is it only supposed to eliminate it from the main feed?

    I can work around my problem, but I’d rather not if I can avoid it.

    Thanks for a great tool.

    Ciao for now!
    Mike

  104. Rich Says:

    Mike Murray,

    The test is

    if (is_feed())

    so I’d expect it to remove posts from all feeds.

  105. L Says:

    i dont know what happened, i didnt touch anything i woke up today trying to access my blog and i get this error messaGE?
    Catchable fatal error: Object of class wpdb could not be converted to string in

    /home/atomicb/public_html/l/wp-content/plugins/category_vis-rh/category_vis-rh.php

    on line 212

  106. L Says:

    nevermind, fixed it!
    1. $cats=$table_prefix.’post2cat’;
    2. //$cats=$wpdb.’post2cat’;

    just uncommented the first 1 and commented the 2nd

  107. Xephor Says:

    Thanks a lot - great plugin!

  108. Pipedreamergrey Says:

    Thanks, this plug-in works great! Actually, it’s more than I needed. It’s given me a couple ideas to improve my site.

    Using this plug-in I’m adding advertising and notices about content found only on my site to my feed and notices about content only found in the feed to the site! Kind of cross-marketing to ensure maximum traffic.

    Thanks

  109. Plugbr » Blog Archive » Plugin para controle de categorias na página principal Says:

    […] Já tinha procurado por um plugin que não permitisse que os posts de algumas categorias do blog apareçam na página principal, e hoje encontrei este aqui, não sei se é a melhor opção mas veio em boa hora. Ele controla o aparecimento dos posts de uma determinada [/tag]categoria[/tag] na página principal, o aparecimento da categoria no sidebar, o aparecimento em resultados de busca e alimentação RSS, além de outros. […]

  110. Pipedreamergrey Says:

    P.S. Did anyone ever figure out how to get this plug-in to work with David Coppit’s Category Order plug-in(http://www.coppit.org/code/)? Coppit’s plug-in let’s you indent categories so that they appear hierarchical, but when both your plug-in and Coppit’s are installed categories disappear all together.

  111. Julie Says:

    HI!!! :)

    I recently downloaded your plugin today; however I am having problems with it. When I go to ‘Manage’ I don’t see any “Catagory Visibility” in my Wordpress. Ever since I downloaded Keith’s catagory visibility, I can’t see anything (concerning this plugin/or something similar to it) in my “Manage” area with my wordpress. Has anyone else had this problem? Any help or feedback would be appreciated!

  112. Alberto Says:

    What I want to do on my blog, is every few hours take the oldest post and move it to the
    front of the queue, all automatically. Anyone know if there is a plugin that can do this or
    a simple way to set up another plugin to do this (use my own feed perhaps)?
    Thanks.

  113. Rich Says:

    Alberto,

    See the Oldest2Newest plugin at: ryowebsite.com/wp-plugins

  114. Gary O Says:

    Rich, Have you updated the plugin to display sub-categories correctly? I tried the hack posted by Linda K (19 August) but it brings up the following error:

    Parse error: parse error, unexpected T_CLASS in D:\Domains\go.id.au\wwwroot\wp-content\plugins\category_vis-rh.php on line 339

    Line 339 is

    } elseif(preg_match(”/class.children/”, $link) && ($children=1)) {

    Any suggestions?

    Gary O

  115. Rich Says:

    Well, Gary O,

    I was happy Linda K was able to solve her problem, because it works great on my websites. Displays categories and subcategories just fine.

    And I can’t vouch for her hack.

    It must have something to do with the theme or other plugins that she and you are using.

  116. Alex Says:

    Hi,

    I am not a technical person, so I am afraid to install this plug-in if it does not do what I need. So here is my question. What if I don’t need to hide categories, rather, I just want certain posts to bypass the home page and go directly to a category. Can it do that?

    Thanks!

  117. Alex Says:

    Hi,

    I think I figured it out. I installed it on my test blog and if I only uncheck “front”, the post goes directly to a category bypassing the front page. My question is, could this be considered “cloaking” by Google and other search engines?

    Sometimes I actually do need for a post for that same category to appear on the home page. I display 10 posts on the home page.

    For example, I posted something for that category a few days ago and it is still on the home page, now I need a new post to go directly to that category bypassing the home page.

    If I uncheck “front”, that post (which was posted a few days ago and still on the home page) disappears.

    Is there a work around? Thanks!

  118. Useful Plugins For Wordpress! at sgknox.com Says:

    […] Category Visibility-RH Rev Alter the visibility settings for categories, for WordPress 2.0. Based on an earlier Category Visibility by Keith McDuffee. By Rich Hamilton. […]

  119. Oliver Says:

    Ive been so happy yesterday to find this plugin. Now I found a little problem that perhaps might be solved very easy. Dont know.

    There is a blog (not mine) where I installed your plugin to make only one special category unvisible. The mission was to write articles to be shown only on the home page so that the owner of the blog would be able to edit his home page whenever he likes.

    Works fine. But today I had a look into the RSS archives page where all categories using wp_list_cats(’…&feed=RSS’); didn`t show up anymore. Everything is possible with wp_list_cats but not the feed option.
    Just found out that the plugin shot the whole category list to hell… ;-)

    Would you please give me a hint how to fix that?

  120. Trip Alexander Says:

    Building a site based on WP for a client and love the idea of your plugin. Theoretically does exactly what I need. However when I activate it, I get the following error. Thoughts on what is wrong. I am only an intermediate user of PHP and extermely new to WordPress. Any help would be appreciated.

    WordPress database error: [Not unique table/alias: ‘wp_post2cat’]
    SELECT DISTINCT * 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_date_gmt <= ‘2006-12-20 00:42:59′ AND (post_status = “publish” OR post_author = 1 AND post_status != ‘draft’ AND post_status != ’static’) AND post_status != “attachment” 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 NOT IN (2) GROUP BY wp_posts.ID ORDER BY post_date DESC LIMIT 0, 10

  121. Trip Alexander Says:

    Nevermind. Another Plugin was conflicting with it. After five looks through the other posts I found a similar issue with your response.

    Thanks,

  122. Zendemic Says:

    Hi There,

    Great plugin you’ve developed here - I noticed that it doesn’t work with David Coppit’s “Category Order” plugin. I’m wondering if there are any other Category Order plugins that might be compatible?

    Cheers,
    Peter

  123. Sebastian Says:

    Thank you.

  124. Stephan Says:

    Thanks… that’s exactly what I need. You’re the man.

  125. Shane Says:

    Hi,

    Great plugin, thank you. One question. When I uncheck “Archives” box, and I access the hidden category directly, I get 404 error. It seems it does not fully hide a category if the posts in it are visible in archives.

    Is this a bug?

    Thank you. Shane.

  126. Mandy Says:

    Hi thank you for the plugin. Works so easy it was a snap to plug it right in. :)

  127. bk Says:

    This plug-in works great, thanks!

  128. Zhe Says:

    I installed the plugin, however I keep getting this message

    WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘ front=1, list=1, search=1, feed=1, archives=1, user_level=0′ at line 1]
    REPLACE INTO wp_cat_visibility SET cat_ID=, front=1, list=1, search=1, feed=1, archives=1, user_level=0

    WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘LIMIT 1′ at line 1]
    SELECT * FROM wp_cat_visibility WHERE cat_ID= LIMIT 1

    and what does mean??

  129. fs Says:

    Hey, I really like your plugin, but it conflicts with Sideblog Plugin v3.0. (I left a comment on the page for that plugin too.) I’m currently have yours deactivated, but if you want the error message I was getting or anything, let me know.

  130. Johan Says:

    Nice, I’ve tried several ways to accomplish this, and your solution is the first one that works. Excellent.

    A question, though, is there some way to remove the category from the post too? That is, if I assign a post to two categories, one of which has all options unchecked, the hidden category is still displayed on the post (like “Posted on Jan 3, 2006 in: VisualCat, HiddenCat”).

    So perhaps there should be another option to check/uncheck, because there might be situations when you want to make a category completely invisible to visitors.

  131. Rich Says:

    Shane,

    Maybe it is a bug. I get a variety of reports regarding the “archive” setting. Some happy, some not.

    Zhe,

    Looks like you’re having problems with Keith McDuffee’s version, not ours.

    fs,

    Yes, there can be conflicts. Sorry, we’re happy to share what we’ve done but we can’t fix conflicts. I guess you’ll have to choose, or reprogram yourself.

    Johan,

    Multiple categories are a challenge in more ways than one. I’ve looked at this before, and, because of caching and the way hooks are designed in WordPress, I didn’t identify a clean way to filter this.

    In my sites, I just leave out the call to the_category(), so NO category hooks are displayed.

    A lame workaround, I know.

  132. notausgang Says:

    many thanks for the lean solution of a whole set of structural problems of my site.

  133. Graeme Says:

    Hey guys im not sure if your aware but there are some compatibility problems with Wordpress 2.1. Ive been using the category Visibility for the last couple of months and upgraded to wordpress 2.1 this morning. For some reason the sub catagories arent hidden, only the text is hidden from the page. Take a look at my page www.graemechidgey.com and you can see on the footer and what i mean! its just a shame as the plugin is great!

    cheers

    Graeme

  134. BigBerries Says:

    ^ Yup. Totally wicked plugin. Totally craptastic with WordPress 2.1. We’re really hoping you this plugin comes back to life for “Ella” because it rules!!!

  135. Talking Out Of Turn » Pain Says:

    […] Update 2: Not only does this version of Category Visibility work, it actually handles the number of posts on the front page better. We appear to have made it through a major upgrade without a loss in functionality! […]

  136. lausse Says:

    Also longing for an 2.1 compatible version.

  137. BigBerries Says:

    We’re going to test the beta as soon as possible but there’s an issue right now with trying to rollback to 2.0.7 from 2.1. Almost as if you “can’t” go back if you upgrade. I’m sure that’s not the case and something is just being overlooked.

    Thanks for the fast response. Be back later to let you know how it goes…

  138. lausse Says:

    As said - at least for me that newest beta feaked the Manage page out. Only shows:

    Catchable fatal error: Object of class wpdb could not be converted to string in /home/snfskane/public_html/wp-content/plugins/category_vis-rh.php

  139. mike Says:

    Your archive of catvis 2.1b2 appears to contain v1.1b1 (beta 1), which unfortunately causes an SQL error on WP 2.1. Is this the correct file?

  140. Rich Says:

    Still working on the 2.1 version… thanks for the feedback.

  141. lausse Says:

    I still (1.1.b3 [beta 3]
    ) get warningmessages when I enter manage in the admin area:

    Catchable fatal error: Object of class wpdb could not be converted to string in /home/mypage/public_html/wp-content/plugins/category_vis-rh.php on line 242

    And that line is following
    $cats=$wpdb.’post2cat’;

  142. thinker Says:

    (beta3) On 2.1, it’s blocking the category listing on the sidebar, but in themes that also list the number of posts within that category, it still lists the number, although it does also omit the link. This may very well be somthing I just need to change in the theme.

    Unfortunately, it also hides the category in the admin section: in the drop-down box for identifying the parent category of a new category (when it’s set to hide front, list and feed). Here it works too well.

    That averages out to working, right? ;)

    It’s definitely progressing. Thank you for your work. I look forward to the fruits of your labor.

  143. Tapanez Says:

    I was using Gudlyf version until upgrading WordPress to 2.1 this morning, database errors appeared. Have installed your plugin with no errors but I’ve some categories checked as not appearing on front page but it isn’t working, for example my “chorradas” one.

    Suggestions?

    Thank you for your work!

  144. Michael Hinz Says:

    The “Object of class wpdb could not be converted to string” error can be easily fixed by replacing $wpdb in that line with $wpdb->prefix

  145. Rich Says:

    lausse,

    I had you try running it with that line commented out (it’s no longer needed)… and it worked, so I’ll post that version as beta 4.

    thinker,

    I’ll try to reproduce the category list thing. Can you verify what function your theme calls to produce the list?

    With beta 3 I changed the method used to detect admin pages… it should now be returning an unchanged where clause, but in beta 4 I’ll try a slightly different approach.

    Tapanez,

    I looked at your website and the “chorradas” category was appearing in the sidebar, but did not seem to be showing up on the front page. To stop that uncheck chorradas for “List.” “List” applies to the sidebar type lists of categories. (So I don’t think that’s a plugin error.)

    Michael Hinz,

    You are exactly right, though it’s an unneeded line, removed in beta 4.

    All,

    You may have noticed that the new version is handling posts which are posted in multiple categories better… if ANY category is marked visible, the post appears. (Before it picked the first category mySql found.)

    The logic here is that if you put it in a category that is visible, you aren’t wanting to hide it.

    I’m uploading beta 4 for testing… although it has only a few adjustments, removing the unneeded line and another approach to admin panel tests. I really appreciate your feedback! Thanks!

  146. André S. Says:

    Hi,
    the problem with listing the number of posts without the category shown in WP 2.1.

    Default theme uses:

    wp_list_categories('show_count=1&title_li=Categories');

    This produces:

    <a href="http://link/to/category" title="View all posts filed under category" rel="nofollow"></a> (1)

    There is indeed no text between the <a>-tags.</a>

    The catecory is not visible, the count is.
    Older themes use

    wp_list_cats('sort_column=name&optioncount=1&hierarchical=0');

    which produces the same output.

    Best Regards and thanks for this plugin,

    André

  147. Graeme Says:

    Hello ive downloaded beta 4, the children is still not hidden, does anyone know if there is a way to do a CSS hack as a temporary measure to hide children catagories? apparently there are some issues with wp_list_categories, on the Wordpress forums some say this will be sorted out in the next version.

    Graeme

  148. love Says:

    Hello
    i install youy plugin in last version wordpress
    after activation it say this error in home page:

    Catchable fatal error: Object of class wpdb
    could not be converted to string in
    /home/lover/public_html/wp-content/plugins/category_vis-rh.php
    on line 212

    Please tell me what is my problem & how can i fix this problem
    thank you

  149. Graeme Says:

    Hey ive kind of found a way to remove the un-selected Children catagories. In your Css paste
    }
    .children {
    display: none
    }

    and this will remove the Children blank subcatagories. This will not remove the un-selected parent catagories though. Thanks for the update Rich!

    Cheers

  150. André S. Says:

    wow, that was fast :) .

    Works perfectly. Thanks again.

  151. Wayde Christie Says:

    @love

    I had the same error.

    I took at a look at the code and noticed these 2 lines around line 242:

    //$cats=$table_prefix.'post2cat';
    $cats=$wpdb.'post2cat';

    If you swap the comment to this:

    $cats=$table_prefix.'post2cat';
    //$cats=$wpdb.'post2cat';

    it works!

  152. Rich Says:

    André,

    Thanks to you, your clue put me onto it.

    Graeme,

    I think the children issue is a WordPress issue, not catvis. Check here: http://ericulous.com/?p=93

    I use Fold Category List plugin, and it seems to work as advertised.

    love,

    Try the beta version.

  153. thinker Says:

    Other stuff works great now (woohoo! thanks)

    I use the stock template for admin files…

    Line 38 of wp_admin/edit-category-form.php calls the dropdown for choosing the category parent:
    category_parent . ‘&hierarchical=1&show_option_none=’ . __(’None’)); ?>

    Hope this helps. I certainly wouldn’t make it a priority as I doubt I’ll be using children of hidden categories, but the additional blank line jumped out at me and I considered how awkward it would be to want to set a child of one hidden category if you had more than one blank line to choose from.

    I am impressed by your speedy work. Thanks again.

  154. Russ Adams Says:

    This is a very nice plugin, but it left the bullet and an empty place where the category would have shown.

  155. Dating Sage Says:

    I having the same problem as Russ Adams. Is there a fix for that issue?

  156. Rich Says:

    Russ Adams, and Dating Sage,

    In order to help, I need more info…

    Are you using the latest beta?

    Are you talking sidebar? What function is getting called in your sidebar?

    What version of WordPress are you using?

  157. Jeff Says:

    I’m having the Same issue as dating sage and russ adams. I’m using the latest beta (5) with Wordpress 2.1. Everything else works perfectly thus far, but I need the category listing.

  158. Breeze Says:

    When I need it, I found you! Thanks!

  159. Ayerst Says:

    Rich, I am using the newest version of WP.

    I love the Cat Visibility Plugin and it works swimmingly with all other plugins in WP 2.05,6 and 7.

    However in 2.1 I get this sql error.

    “WordPress database error: [You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ‘(SELECT post_id FROM wp_post2cat LEFT JOIN wp_catt_visibili]
    SELECT SQL_CALC_FOUND_ROWS wp_posts.* FROM wp_posts LEFT JOIN wp_post2cat ON (wp_posts.ID = wp_post2cat.post_id) WHERE 1=1 AND category_id IN (6, 4, 7, 8) AND (post_type = ‘post’ AND (post_status = ‘publish’ OR post_status = ‘private’)) AND ID = ANY (SELECT post_id FROM wp_post2cat LEFT JOIN wp_catt_visibility ON (wp_post2cat.category_id = wp_catt_visibility.catt_ID) WHERE ((wp_catt_visibility.cv_user_level<=10) OR post_status=’static’ OR wp_catt_visibility.catt_ID IS NULL)) GROUP BY wp_posts.ID ORDER BY post_date DESC LIMIT 0, 7″

    I am uncertain what this means (still learning Dbases.)

  160. Dating Sage Says:

    I am using beta 5. I am talking about the side bar. I am not sure how to tell which function is getting called. You can view the site by clicking on my name. I am running 2.1.

  161. BRA5iL Says:

    Since WP 2.1 the method cv_get_posts(’numberposts=5′) keeps listing pages as well??

    Is there a way to prevent this?

    Thank you…

  162. Paul Oyler Says:

    I just installed beta 5 on a new site running WP 2.1

    I think it is working fine, I just want to check on a behavior - if I am logged in as the admin, am I supposed to still see the chosen category on the front page? I thought that the plugin was not working at all until I checked the site on a different browser (on which I was not logged in) and all of the posts in the chosen category were NOT visible. When I am logged in, they ARE visible. Is this the correct behavior?

  163. Michael Says:

    beta5 works well except the posts still show up on the home page of my blog. I’m not sure if that is on purpose but I was expecting them to be hidden.

    thanks!

  164. Markus Says:

    Hi, i´m not sure, but i think i found a bug: i have a category-list wiht 3 level. with your plugin, the list has a failing: after level 3 is level 1 list in level 2 and not in level 1. understand you? try it with

        <?php wp_list_cats('hide_empty=0&hierarchical=1'); ?>
    

    list is ok without your plugin. but activte i your plugin, list has a failing.

    can you fix it?
    thank´s for your work!
    markus (sorry for my terrible english!)

  165. BRA5iL Says:

    I managed to patch the issue with the appearing pages on cv_get_posts()

    @line 479 I added “AND post_type=’post’ ”
    to the SQL…

    Maybe you can fix it or provide a switch. Afaik the original get_posts() does NOT bring up pages…

  166. weasel Says:

    I tried out your plugin and it’s great! Beta5 and it runs fine on my 2.1 WP install.

    One little glitch, can’t really blame you for it - after setting up the permissions, I went and changed a few category names and descriptions. I had to change/re-save all the permissions in your plugin for it to “see” the new categories, despite the status being listed correctly on your plugin page.

    E-Mail me for details. =)

  167. weasel Says:

    Oh hey just found another bug (may be related to the one listed previous) - If I’m in the admin panel, and I hit the “view site” button and it takes me back to the main page with a clean URL

    thedailyblitz.org/

    My categories posted as “not visible on the front page” are indeed visible. If I hit refresh they all go away. Any idea what’s causing that?

  168. Joe Says:

    It’s not often you see this level of control in a plugin. That’s awesome. Great job.

    I’m using the plugin for the first time with WP 2.1 and beta5. As some others have mentioned (and I haven’t seen an answer but I could have missed it) I’m having the problem where Months/years are showing up in my archive listing that contain posts that are in categories that I have set to be hidden. Is there a work-around for this so that if there are only hidden posts in a given month then it won’t show the month name under the Archives heading?

    Thanks!

  169. ALV Says:

    cat-vis is one of the best plugins and it’s really great that someone feels responsible for keeping it running :-) Thank you, Rich. I just upgraded our blog to WP 2.1 and installed the beta version of cat-vis. Hitting the “search”-button I received the same error msg Ayerst did. Did someone find already a solution? Unfortunately it’s not connected to the php version (we use 4.3.10-16). It would be great to get some help! Thank you!

  170. maddagu Says:

    […] that’s such a handy plugin. first i had a separate blog for my photos and now thanks to that… all in one. just tell it wich category you don’t want to see on the frontpage and off you go. make a separate link for the category. ready. easy. here is the link socialize […]

  171. sayed Says:

    I’m getting the same message as Ayerst and ALV. Any ideas?

    WordPress database error: [You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ‘(SELECT post_id FROM wp_post2cat LEFT JOIN wp_catt_visibili]
    SELECT SQL_CALC_FOUND_ROWS wp_posts.* FROM wp_posts WHERE 1=1 AND (post_type = ‘post’ AND (post_status = ‘publish’ OR post_status = ‘private’)) AND ID = ANY (SELECT post_id FROM wp_post2cat LEFT JOIN wp_catt_visibility ON (wp_post2cat.category_id = wp_catt_visibility.catt_ID) WHERE ((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)) ORDER BY post_date DESC LIMIT 0, 5

  172. Wayde Christie Says:

    If I click my Edit page link whilst viewing the blog then save I get this error:

    WordPress database error: [Unknown column ‘category_id’ in ‘where clause’]
    SELECT wp_posts.* FROM wp_posts WHERE 1=1 AND category_id IN (8) AND (post_type = ‘post’ AND (post_status = ‘publish’ OR post_status = ‘private’)) GROUP BY wp_posts.ID ORDER BY post_date DESC

    This error then disappears as soon as i refresh the page.

    Any ideas?

  173. Bill C. Says:

    Works for me. Thanks for updating. :D

  174. Tommy Miles Says:

    A wonderful plugin! Absolutely CRUCIAL if you’re trying to do anything at all complicated.

    I’m more used to Drupal, so trying to get clever with Categories drove me up a wall for two days!

    This should really be part of any base installation of Wordpress.

  175. Alen Says:

    Hi, I have recently moved to WP 2.1 and downloaded your latest version of the plugin. Beside the fact that it does a great job for me, it creates one little problem! Posts are listed multiple times if they are assigned to multiple categories. 3 categories, 3 times… etc.
    They are not multi-listed on the category template but in the single template and RSS feed!?!

    I know that cat-vis creates this problem, since it does not exist when I deactivate the plugin.

    Is anyone familiar with this?

  176. Mal Says:

    I have the latest version of the plugin (2.1beta5) running on my development site which is here:
    http://www.stippy.com/wp_dev/

    The plugin is active, and is set not to show the “japan-language/english-word-of-the-day” sub category anywhere. But, as you can see, it is displayed on the front page of the site (about the 4th post down, Title is “E-WOTD: Cuckold”).

    Any other info that I should provide? I love this plugin, but it is really not working in my site with wp2.1.

  177. Jauco Says:

    I have a mysql server 4.0 running, so I get the error in query (like some other people commenting). I believe the subqueries where added to fix a problem with posts who have multiple categories. As it happens, the post I’m trying to hide doesn’t have double categories. Could you republish a version of your 2.1 compatible plugin with the old query?

  178. TIGOS Says:

    When we will have an update of this plugin for Wordpress 2.1?

    Thanks!

  179. Randa Says:

    I’m still using WP 2.0.7 and your plugin is giving me this error:

    Catchable fatal error: Object of class wpdb could not be converted to string in /home/.keller/themoss/themosspit.net/wp-content/plugins/category_vis-rh/category_vis-rh.php on line 212

    I’ve had absolutely no trouble with it up until this point. Can you please help? Thanks a lot!

  180. Rich Says:

    Version 1.0.0e has been posted to correct the object translation error. (This version is for WP 2.0.x and is still not WP 2.1 compliant.)

  181. Lynne Says:

    What’s the timeline for the 2.1 version of this plugin to be finished? I am trying to develop a Scoop-like user post/front page system (like a basic dailykos.com) for a new version of my own blog, and using this plugin AND Category Restriction, I think I can do it with far less tweaking than I first thought. (I’m also hoping to add some sort of rating/recommend system for non-front-page posts to get into a recommended list, but that might have to wait. sigh)

    But of course, I’ve just installed 2.1 as the core code…and I’d like to install a stable version of this plugin with it (though I might grab the beta just to find out if that plugin combo will do what I need, and/or help you with bugs).

  182. Brian Says:

    Did you ever know that your my hero. Your everything, everything, everything, I wish I could be. (nice plugin. Spent hours…no…days trying to find it) And I can fly higher than an eagle. Fly! Fly! Fly away, you let me fly so high. Thank you, thank you. Thank God for you, the wind beneath my wings.

  183. Randa Says:

    Thanks for the fix! It’s working fine now :)

  184. Jeff Says:

    Any kind of estimate on an update for the 2.1 branch? I’d really like to resume using this, but i need my category list to show up :/

  185. Jeff Says:

    I’ve figured out the switch that does it! If you include &feed=rss or &feed=anything in the arguments, for that matter, the cat list dissapears. For now, I’ve avoided the issue by disabling RSS listings, but it is kind of a pain :(

  186. ALV Says:

    YES! YES! YES! You didt it, man! It’s working fine now. Thanks a lot! Although I use it only at work, I’m willing to show you my appreciation, Rich, with a donation (Paypal?)

  187. Jurgen Says:

    I tried the version that was up last night (I think it was still Beta 5?) and it didn’t work yet. It was throwing up a bunch of errors; I’m sorry I didn’t keep track of them in my hurry to revert to 2.0.

  188. Lynne Says:

    This plug in (beta 6) still isn’t working at all for my 2.1 install. (php5, MySQL 5.0.24)

    I have checked off Exclusion, which should mean that any post which has a category unchecked should make that post disappear for that element. For instance, I am trying to keep one category OFF the front page. Trouble is, both posts which have categories allowed on the front page, and posts which have the category with categories NOT allowed on the front page are showing up on the front page.

    Previously, I had tested the opposite as well: No Exclusion cheched off; and I had a category called “Front Page” which was the ONLY category checked off for going to the front page, and it still was not working. Every other category was unchecked for front page appearance, but still appeared on the front page.

    In other words, I’ve tried it both ways, and everything is showing up all of the time no matter what I do.

    (You can see current iteration - with category “user post” which is checked off NOT to appear on the home page, here: www.leftinlowell.com/lil2)

  189. Lynne Says:

    To add: I have “list” unchecked on ALL categories right now, and it’s still not working - they are showing up in the sidebar (I have not changed the sidebar from the theme default) in recent posts.

  190. Jurgen Says:

    Bless you, it seems like Beta 6 is working for me now, too. Thanks so much for the quick fixes. It’s much appreciated.

  191. Lynne Says:

    All right, I figured something out at least. This is how the plugin (beta7) is not working for me (I’m on php5 and mysql 5, WP2.1).

    I am trying to make one category NOT appear on the front page (also cat lists and archives, but I’m concentrating on the front page). I have Exclusion checked, though I’ve started out testing with only having one category checked off on each test post so that shouldn’t matter.

    When I am not logged in at all, I can see the front page correctly. The 2 posts in the “User Posts” category, which I do NOT want to have appear on the front page, do not appear. However, the instant I log in with a user name, whether that’s level 10 (admin) or just a Subscriber, or anything in between, the plugin breaks and all posts appear on the front page, including the ones which are unchecked for being on the front page. If you want a test Subscriber, I created a user named “Joe” (password “Joe”) to test this out…

  192. Jauco Says:

    Woah! latest version works great! You rock!

  193. kapeka Says:

    Hi;

    I’ve made the same observation as Lynne (posted on Feb 13th).

    Using wordpress 2.1, beta7 of catvis and mysql 4.0.x (I understood that mysql 4.1 isn’t a requirement any longer).

    I hope this can be fixed.

    thx
    kapeka

  194. Wayde Christie Says:

    Latest version working brilliantly - many thanks!

  195. Neil Says:

    To kapeka and Lynne, you may need to deactivate and reactivate. Worked for me.

    Thanks!

  196. Lynne Says:

    Neil: Nope, no go! Deactivated and then reactivated, then logged out and log in as any user - the “User Post” category which is unchecked for front page is still showing up on the front page.

  197. Lynne Says:

    OK this is really freaky…more specifics about this stange behavior:

  198. Lynne Says:

    OK this is really freaky…more specifics about this stange behavior:

    If I am not logged in at all, I get the correct category behavior on my front page.

    I log in as Sue. Or Joe. Or admin. Joe’s just a Subscriber, Sue’s an Author. This behavior seems to be common across all roles. Once I log in at the login screen, it takes you to the administrative back end (for Subscribers, of course, all you can do is change your profile). Then you click “View Site” at the top, and you see the front page again. The categories which should NOT be visible on the front page suddenly are. If you hit refresh, still these categories show up on the front page. However, IF I, logged in as any user, resubmit the URL (highlight the URL in the address bar and hit return), the page views correctly.

    In other words, it looks like if you are coming from the admin screen (whether you are an admin, Author, or Subscriber), then the category visibility plugin is not working.

    Hope that helps!! kapeka, see if you have the same behavior?

  199. Lynne Says:

    One more comment: conversely, if I, once logged in, am in the administrative section, but instead of using the link from the admin page (”View Site”) I put the URL in myself in the address bar and hit return, I get the front page displayed correctly.

    But the “View Site” link in the admin section IS the same URL I just typed - getting you to the front page.

  200. Jeff Says:

    I’ve experienced the same behaviour as Lynne, but I didn’t mention it since I didn’t mind it too much. It is really odd though

  201. Kn10 Says:

    The plugin (beta7) is having no effect on my WP 2.1, as if it wasnt even installed. All the categories are on the front page. There are no error messages, I have checked it is activated, I have deactivated and reactivated. I have gone to the settings and clicked “Submit Changes” to hopefully ‘lock it in’. Still no effect.

  202. Kn10 Says:

    I found this as an alternative for now that works with 2.1 . I will switch back to this plugin when it supports it properly. My loyalties lay with Category Visibility but I am pretty desperate and need SOMETHING for now. Perhaps you can jack some code from it? ;)

  203. kapeka Says:

    Indeed, I can confirm it - as soon as any user comes from his small “admin page” via “view site” anyone see’s every post.

  204. Rich Says:

    Beta 8 corrects for the “view site” problem, and a few others.

    The Exclusion Logic feature is a new feature, which I’m mentioning for the first time (though Lynne has been trying it). Some have asked for this and it’s been a challenge. My tests show Exclusion Logic working now, provided you have MySql 4.1 or later.

    With Exclusion Logic you should be able to set up a category called “Hide from Front Page,” uncheck Front and List, and check the “Hide from front Page” box as an additional category for any Post you want kept off the front page. Some people have been asking for this, and it’s radically different than the standard logic for Category Visibility. If I was to name it, I would call it “Category Invisibility.”

    Keep me posted on your results. It really helps if you tell me which version of MySql you have; I display that at the bottom of the Manage CatVis page. And tell me if you’ve checked Exclusion Logic or not. It’s really important to know which logic is working, and which is not.

    BTW, If your version of MySql is below 4.1, the checkbox does not appear, so don’t get crazy because you can’t find it.

    I also want you to know that I read every comment and work on this every day. And I don’t release a new beta until my test systems show it’s working and I feel reasonably certain the issues in comments have been covered.

  205. Escriba Labs » Os melhores plugins para Wordpress Says:

    […] Category Visibility-RH Rev - Plugin muito útil para quem quer ter maior controle sobre a exibição de suas categorias. Você escolhe qual categoria aparece ou não na página inicial, no feed, nos resultados de busca e nos arquivos. Muito flexível e fácil de usar […]

  206. Wayde Christie Says:

    I just wanted to say a BIG THANKYOU for your efforts with this plugin. I had several issues with earlier versions, but you fixed them all. The site I’ve built using your plugin would’ve been a LOT more difficult without it. Thanks again. If you had a ‘donate’ link I’d be clicking it!

    http://www.mountain-living.com/

  207. Lynne Says:

    Thanks Rich for the email heads-up on Beta 8. The problem I listed above is now fixed.

    Exclusion works, in that when I select two categories, one of which is not to be listed on the front page, and one that is supposed to, the post disappears like it’s supposed to.

    Here are some other errors I’ve noticed now that I am playing further with the plugin:

    1. When I go to edit a post which has an invisible category attached, the edit page iterates the category selection list with the “invisible” category at the top, even though alphabetically it should be further down. When editing a post which does NOT use the invisible category, or when writing a new post, the invisible category iterates in alphabetical order. Not a show-stopper as far as I’m concerned, but quirky.

    2. When I go to Manage -> Categories and want to add a new category, I cannot select any of the categories which are unselected in CatVis as a parent for the new category. Some categories I created are invisible on multiple items, some I only deselected one, like List. Strangely enough, the drop down for selecting a parent for a new category iterates a space for the missing categories, but there’s no text. However, even stranger, selecting one of the blank spaces puts it into one of the invisible parent categories.

    Screenshot here, and here. The first shot is of the page which hasn’t been refreshed (there’s an extra # in the HTML character, which I suspect is the culprit here…that should be a quick fix). The second screen is after leaving the Manage Categories page and coming back. The dash iterates fine in the second instance.

    Hope this helps.

  208. Lynne Says:

    Oh, and I am on MySql version: 5.0.24

  209. Lynne Says:

    Oh and one more error:

    When I have a post with two categories, one of which is invisible (User Post), one of which is all checked visible (Town Name 1), I went to click on the visible category from the sidebar list (Town Name 1) and Wordpress spit back out “Error 404 - Not Found” (I think that’s WP basic theme’s way of saying “nope, no posts found in that category, sorry!”). When I make a second post with JUST the visible category, then click on that category on the sidebar, I get only that one post in the page for that category. However, on the front page in the sidebar category listing, it shows that there’s two posts in that category.

    Duh, I just realized that I unchecked the category “User Post” to not appear in the archives, when I check it back into archives, I get both the posts. I think that’s as it should be. However, I would make some code to make any category which is typically visible on the sidebar but ONLY has posts in it that have a second category UNchecked for archive to NOT show up on the sidebar category listing. Or else users will get that same error of finding no posts that I described above.

    I hope I am helping and not giving you headaches. :) Thanks for working on this so diligently, I greatly appreciate it. Once this is working at full capacity, I will be able to get my new version of my site to do EXACTly what I want it to do. So thanks. If I have some spare dough soon I’ll send you some.

  210. Lynne Says:

    Oh, and the sidebar thing I mentioned above is only WITH exclusion checked. With Exclusion unchecked, I think this is all moot. It seems to work fine.

    [/end monopolize comment thread]

  211. Stef Says:

    Thanks for the great plugin, it’s very, very handy!

    If I had one request it’d be that you considered using the official WordPress plugin repository here:
    http://www.wp-plugins.org/

    This’d make it easier for others to contribute code and for users to submit bugs through trac, as well as updating to the latest version if they use subversion. (I use it to keep several WordPress blogs up to date using svn:externals for the plugins and other external code.) And, of course, it’d (hopefully) make development easier for you by providing you with version control :)

  212. fp Says:

    Thanks for the great work!

    Beta 7 used to cause a weird problem that the order of the post on the front page was reversed. But Beta 8 works without any problem. :)

  213. Wordpress Plugins Themes Download » Blog Archive » WordPress ‘Category Visibility’ Plugin Says:

    […] http://ryowebsite.com/?p=46 […]

  214. Andre S. Says:

    Hi,

    the posts to be excluded are still displayed in “single” view for the next/previous post links. The functions that provide this links are previous_post_link() and next_post_link().
    It would be great when the plugin would also allow to not show the category there too.
    Thanks for your work so far.

  215. LostInNetwork Says:

    Exactly. We are using this as a security tool, not a layout tool. We are not protecting sensitive information just with this feature, but a complete coverage of all display functions would still be very very much appreciated.

  216. Andreas Says:

    Thanks for your work, I appreciate it a lot! Here is why:

    Your plugin is now used on the largest blog in Sweden, a site with more than 30.000 visitors every day. We are using it to hide posts in the news category from the frontpage, and very soon we will try to make one of the blog categories visible only to registered users.

    I hope that brings some inspiration to your coding, you’re doing a great job. :)

  217. mr.ape Says:

    Great plugin, thank you!

  218. Jeremy Says:

    I am having an issue with the plugin, where categories are not being listed in the sidebar, regardless of their exclusion options being checked or unchecked. Changing the “Front” options for those categories does work with the main page, though.

  219. Rich Says:

    Jeremy,

    1. Are you using beta 9 or another version? What version of wp are you using?

    2. The sidebar listing should be dependent on whether you check or uncheck “List” for each category.

    3. This may vary if a non-standard function is being called.

    If the front option is working on the sidebar, it sounds as if a non-standard function is being used to list the categories in the sidebar.

  220. Jeremy Says:

    I was using beta 8, and just installed beta 9. Both give me the same result.

    My sidebar was using :

    <div id="categories">
    <h3><?php e(’Categories:’); ?</h3>
    <ul>
    <?php wp_list_cats('sort_column=name&optioncount=1&feed=rss'); ?>
    </ul>
    </div><br />

    Swapping the command to “list_cats(” seemed to clear up the issue I spoke of, but it generated another problem. The category names are present, but the post count and rss links are gone. “Uncategorized (2) (rss)”.

    WordPress version is the most recent : (2.1)

    What functions do you recommend using for this area of WP sites?

  221. Jeremy Says:

    This might help a little, though I still can’t seem to find my own solution after this step.
    The problem I was having resolved itself if I removed “&feed=rss” from the fourth line in the categories portion of the sidebar. The Categories reappeared, along with the post count - but, I no longer have the feed link.

    I tried removing “&optioncount=1″ and leaving “&feed=rss” ;
    The list was still absent.

    Then, I tried changing “&feed=rss” to read “&feed=1″ ;
    The list returned, with “1″ as the title of the rss link.

    I tried changing the value after “&feed=” to “2″ and “0″ ;
    With “2″, the list was absent. With “0″, the list was present, but had no feed link.

    I changed it back to “&feed=1″.

    Then, I tried reinserting “&optioncount=1″ ;
    The list was absent again.

    This brings me to two conclusions :
    First, both flags cannot be present at the same time if the plugin is active.
    Second, the “feed” flag value is being read as a switch, to enable it with “1″ or disable it with “0″, as long as the plugin is enabled.

    Without the plugin enabled, any combination and number of predetermined flags can be inserted between the parentheses, with their values being read in a predetermined way. Specifically, “&feed=” reads its flag as a string, and not true/false.

    Somehow, the plugin is changing the behavior of the wp_list_cats() function, and I need to find a way to counteract that behavior.

  222. TheMystical Says:

    I just upgraded WP to 2.1 and thankfully your beta 9 so far seems to work pretty good.

    Thank you

  223. Ann Says:

    Having the same problem with beta 9 as Jeremy with the wp_list_cats() not functioning properly (using list_cats() as a workaround).

    If a post is in both a visible and invisible category, it still shows up as visible on the front page… is this the intended function? I would think that invisibility would be the overriding default…

  224. Rich Says:

    Yep. It’s a Category Visibility function, not Category Invisibility.

    To some folks it’s obvious that if a post is marked for any visible category, it should be visible.

    And, to some other folks it’s just as obvious that if a post is marked for any invisible category, it should be invisible.

    We’ve been toying with an “Exclusion Logic” option that would take the latter approach.

    Part of the trick is that some functions in wp have changed and they’re surprising us.

    And the other part of the thing is that I do have a real job that takes a lot of my time.

  225. LostInNetwork Says:

    “We’ve been toying with an “Exclusion Logic” option that would take the latter approach.”

    Oh, that’s what option pages are for :)

    “And the other part of the thing is that I do have a real job that takes a lot of my time.”

    I share your pain :( Many of us are burdened by this thing called “job”, and yes, it does take a lot of time. So we do understand that coding free software must suffer - that’s life. Take your time, and know that your efforts are greatly appreciated.

  226. Tomas Says:

    Hep, Great Plugin.

    Downloaded your Beta9 and running with WP2.1.1.
    Seems to work fine, but when viewing a post, then the previous or next post link pointed to a post belonging to a category that should be hidden by your plugin. The category is not a subcategory.
    Clicking on the link, also showed the post - which I was expecting to be hidden. The post does not belong to any other categories.

  227. LostInNetwork Says:

    “Since Pages aren’t really part of the Post/Category system, we don’t want them excluded, so I fixed that.”

    You don’t want them excluded. I do.

    We use categories to contain messages targeted at various audiences. We have public categories, we have members categories, and we have staff categories.

    We also have public pages, we have member-only pages, and we have staff pages.

    For my needs, exclusing pages from display would be a welcome feature. Could it be retained as an option?

  228. Rich Says:

    LostInNetwork,

    You’re entirely misreading this. In WP, searches cover only Posts. Some folks want searches to include Pages, too, so they use a plugin for that.

    When they do, they discovered that Pages were assigned the default category and you had no control over that. In general, that was ignored. The old CatVis didn’t ignore it, however, and excluded Pages from searches if the default category was unchecked.

    What you’re describing would require setting up a category system for Pages, then setting up filters. That’s a whole new plugin and way beyond the scope of CatVis.

  229. Brance Says:

    The beta is doing something very weird for me. when I activate it and then go to manage the cat vis I see my blogroll (category 0) and my about us (category 2) and they are repeated over and over again each repeat adding a new - in front of the cat name.

    any ideas what’s causing this?

    all I want to do is exclude one cat from my main feed.

  230. Brance Says:

    Turns out it was the number 0 as the blogroll cat id. I assigned it an unused cat id # and that fixed it.

  231. Chris Says:

    This plugin rocks. Saved my day.

  232. Deezil.us » links for 2007-02-28 Says:

    […] WordPress ‘Category Visibility’ Plugin»Run Your Own Website (tags: wordpress plugins jimburch) February 28th 2007 Posted to Uncategorized […]

  233. Edward Says:

    ‘Category Visibility’ beta 9 fixes things perfectly for me. Thanks!

  234. Alexander Hahn Says:

    The new Beta 9 made my day! thank u so much!

  235. katesgasis.com » Blog Archive » Updated Sideblog to version 3.7 Says:

    […] I’m back and I may have what Sideblog users are looking for: a much needed update of Sideblog plugin. You can download version 3.7 here. The update includes compatibility with the Category Visibility plugin. […]

  236. Mookie Says:

    This plugin is better than bread and butter ! I love it.

    I downloaded the ver e, and it works like a champ. But I noticed that when the post is assigned to more than one category, the text for the post is posted twice ?

  237. How to Spam Your Wordpress Blog! » SiteLogic Web Development Says:

    […] For that you can use the Wordpress Category Visibility Plugin which does a nice job of hiding your categories. You can choose in which options the category will appear, like so: […]

  238. Joan Planas Says:

    Great plugin!! please upgrade wordepress 2.1.2, now don’t work.

    GREAT!!
    Thanks!

  239. Eric Smith Says:

    I used Gudlyf’s version until I upgaded Wordpress. Now I’m using your beta 9 with Wordpress 2.1.2, and it works great! Thanks!

    Mookie, I saw the same thing (duplicated posts if in multiple categories). That’s because you’re using 1.0e which isn’t supported on Wordpress 2.1. Use beta 9 instead and you won’t have that problem.

  240. Tison Says:

    This is exactly what I needed, thank you so much.

  241. Rafael Says:

    Hi there;

    It’s a great plugin, indeed! I just need a little help setting something: Let’s say I want to create a category that works in conjunction with any other category and it serves to hide posts from users below author level (meaning author, editor and admin would see, but contributor and subscriber wouldn’t), how should I set the options to get so?!?! I’ve tried many things but none gave me what I want. I can set it to hide from higher levels while still being visible to lower levels, but not the opposite.

    Thanks a bunch!

    Rafael

  242. cent Says:

    Hi… the CV plugin was generating an error when I would try to Manage Posts -> Browse by Category. Removing the plugin fixed it. I’m using WP 2.1 and CV 1.1.b5 (beta 5). Has this been fixed in Beta 9?

  243. Mookie Says:

    @ Eric Smith

    That worked perfect ! Thanks a buncho !

    Good Lawd this plugin is cool !!!

  244. Mike Says:

    Tried this plugin and it works okay. However, the post was visible using the TAGS it was filed under. For example, I created a post in a new category (uploads) that I set use access level to 10 with a TAG of teST. When I was logged in as an admin, the category showed up in the list and the post showed up on the main page and in searches, etc. BUT, when I logged out…the category was hidden and so was the post (great!)…but when I clicked on the teST TAG it still showed the entire POST. Needs some work still. Just thought I’d share.

  245. Rich Says:

    Mike,

    Category Visibility is not intended to make posts invisible. It’s not a security tool.

    It’s a visibility tool for, well, categories.

    It’s designed for folks who post things they don’t want the general public to find, but might make available to folks through direct links.

    As an example, a website for a technical product might “hide” support articles from the Home Page, but want them visible in the sidebar.

    Another example: This very website is for my clients who want to run their own website but who probably don’t want to learn how to upload a plugin. So I hide this entire category, “Free Wordpress Plugins,” because I don’t want them bothered. But you and many others get easy access, because you found a link somewhere and were looking for this exact capability.

  246. Yumechris Says:

    thank you! tha was what i need!

  247. Rene Says:

    Hi,

    <?php my_get_recent_posts(0, 5); ?>

    returns the titels of the most recent posts, including posts in categories “shielded” by the category visibility plugin (version 1.0.0d (the category should be visible only to logged in people higher then “2″). How do I work around it?

  248. Serge Says:

    Thanks Rich,

    Great plug-in.

    Quick question. Is there a way to have a particular category show up on a page other then the front page, while still showing those post on the front page?

    Basically:
    Front Page - Category 1 and Category 2 posts
    Other Page - Only Category 2 posts

    Thanks!

  249. Rich Says:

    Rene,

    Not sure, but you’re working with a modified version of get_recent_posts which could be the problem.

    Serge,

    A Category page will show a single category, i.e., only Category 2 posts.

  250. Battra Says:

    I found a bug (I think). This was also mentioned by Markus on January 29th, 2007 at 11:29 am

    I have 3 levels of categories like this:
    Parent1
    - Child1
    - Child2
    — GrandChild1
    — GrandChild2
    Parent2

    Both CatVis for WP 2.0x and 2.1 (beta 9) display the category like this:
    Parent1
    - Child1
    - Child2
    — GrandChild1
    — GrandChild2
    - Parent2 (this should be at the top level, not child level)

    Any idea how to fix this? Other than that it works great! Thanks for the writing the plugin, saves me from having to hack the sidebar template :)

  251. 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

  252. 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.

  253. 从源辞典 » Blog Archive » Useful plugin for WordPress Says:

    […] Category Visibility-RH Rev Alter the visibility settings for categories, for WordPress 2.0. Based on an earlier Category Visibility by Keith McDuffee. By Rich Hamilton. […]

  254. 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…

  255. 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

  256. Plugin para controle de categorias na página principal Says:

    […] Já tinha procurado por um Plugin que não permitisse que os posts de algumas categorias do blog apareçam na página principal, e hoje encontrei este aqui, não sei se é a melhor opção mas veio em boa hora. Ele controla o aparecimento dos posts de uma determinada categoria na página principal, o aparecimento da categoria no sidebar, o aparecimento em resultados de busca e alimentação RSS, além de outros. […]

  257. 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!

  258. 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!

  259. 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.

  260. 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)

  261. 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.

  262. 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.

  263. 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.

  264. 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!

  265. 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.

  266. 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.

  267. 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

  268. 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!

  269. 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

  270. 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…

  271. 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

  272. 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.

  273. 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

  274. 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! :)

  275. 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…

  276. 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.

  277. 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. :)

  278. 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>

  279. 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?

  280. 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

  281. 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?

  282. 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

  283. 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.

  284. 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

  285. Chris Says:

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

  286. 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?

  287. 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

  288. Jonathan Rochkind Says:

    Does this plug-in work with WP 2.2?

  289. 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

  290. 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

  291. 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!

  292. infernor Says:

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

  293. P.Hedges Says:

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

  294. Nifty Says:

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

  295. 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?

  296. Mark Says:

    Work’s fine with 2.2.

    @ Trisha:

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

  297. 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.

  298. 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?

  299. Ajani Says:

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

  300. 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

  301. pixelcow Says:

    I’d really LOVE to use your Plug-In as it seems the exact solution to my “problem”. Too bad it’s not compatible with the 2.1-versions at the moment. I just want to hide the “Server-Status”-posts from the front page but keep them still accessible via the menu.

    There’s nothing to hide about my (self-so-called) server-downtimes or problems with ping-times and such stuff - but it messes up the “real” content from time to time.

    ad Ajani: think so too, waiting for it since version 1.x =:^)

  302. ck Says:

    For some reason your plugin causes posts to show multiple times even though only one shows in admin. Any ideas about how I could fix this?

  303. Nate Says:

    Beta is working great on v2.2.1, and fixes the multiple category - multiple posts problem! Great plugin! I agree, should be part of the WP core.

  304. Eric Smith Says:

    Andrew & ck, if you read the earlier comments you’ll see that you need the beta to avoid the multiple post problem. The 1.0.0e and earlier versions are NOT intended for use with WordPress 2.1 and later.

  305. ruralmoon Says:

    Problem:
    typing in the permalink of a post as the URL causes the post to be displayed even if the category it belongs to is not visible to the user.

    Solution:

    Modify the “cv_posts_where” function, add code as below.(use is_single() to determine if this is permalink)

    ......
    elseif (is_search())
    $where .= " AND (($cat_visibility.search=1 AND $lc";
    // add permalink check
    elseif (is_single())
    $where .= " AND (($cat_visibility.archives=1 AND $lc";
    ......

  306. graham Says:

    I’ve installed this plug-in and it works perfectly, except on feeds.

    Categories that are not selected for feeds are still showing up.

    Any ideas?

  307. Bob Says:

    Just installed beta9 on WP v 2.1.2
    PHP version: 4.4.4
    MySql version: 4.1.21-standard
    Category Visibility version: 1.1.b9 (beta 9)

    and on another site running WP v 2.2.1
    and all is working fine so far. Have not tested feeds yet, but hey, works for me on the home page which is the big picture.

    Thank you, great work on this.

  308. ck Says:

    I get this error when excluding category 12 from the front page:

    <p>WordPress database error: [Not unique table/alias: 'wp_post2cat']
    SELECT SQL_CALC_FOUND_ROWS distinct 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_post2cat.post_id = wp_posts.ID WHERE 1=1 AND (post_type = 'post' AND (post_status = 'publish')) AND ((wp_catt_visibility.front='1' AND wp_catt_visibility.cv_user_level&lt;='0') OR post_type='page' OR wp_catt_visibility.catt_ID IS NULL) AND wp_post2cat.category_id NOT IN (12) ORDER BY post_date DESC LIMIT 0, 10</p>

    Seems to work fine for excluding it from the feed though. I really wish it would work with feedburner plugin too.

  309. lucy Says:

    Just installed on 2.0.1. works out of the box, perfect, just what i needed. Looking forward to the full version for my 2.1.2 upgrade..

  310. Bryce Says:

    I’m sorry, I started reading through these comments to see if my question is addressed but there were too many! And I’m lazy!! Anyway, this plugin works great when simply navigating through the front page and using the Previous and Next Entries links. However, if you navigate directly to an individual posts page and a “hidden” post is the previous or next post, you can access them this way.

    Hopefully I explained that semi-coherently. As an example, if you click on my “Garlic Powder” post directly, you can then click on the post prior (”I know we’ve only…”) and view it, even though it belongs to a hidden category.

  311. David Says:

    I’ve just added v1.0.0e to my WP2.2.1 site. All seems well apart from as per Bryce’s comment above. I can still request a page from the url with ?p=XX and it will return the page. Also categories that are surpressed by userlevel still show the number of entries in the catgories part of the sidebar even though they don’t show the category name. Thanks

  312. David Says:

    Ooops! Upgraded to 1.1.b9 (beta 9) (still on WP 2.2.1!) - category sidebar no longer shows number of entries for suppressed categories, but I can still navigate to pages in surpress categories. Thanks again.

  313. Mark Says:

    Greetings -

    For some reason, the category pages that I have created do not get picked up when I do a technorati ping? Does anyone know the reason for this?

    Thanks,
    Mark

  314. Andreas Says:

    Hey, thanks once again for a GREAT plugin! I have a couple of questions:

    Is this plugin still in development? Will you add any more features (or options) soon, and would it be OK to send you a feature request? If so, I would be happy to sponsor the plugin with a donation since this plug is incredibly useful. Feel free to write me a line if this sounds interesting.

  315. Hal Says:

    Great plugin - does anyone know how to set catergories into a particular order ie with a plugin /hack . Any help much apreciated.

  316. Hal Says:

    Ive found one and its brill http://geekyweekly.com/mycategoryorder/ its a plugin that sets a widget and you just swap it for the existing category.
    Not sure if it will work with this “cat.visi” plugin though as ive deactivated it for now.
    Thanks

  317. Vic Says:

    Thank you for such a great plugin list. For the new person this list are just priceless.

    Thanks

    Vic

  318. Lorna Says:

    Thanks for the plugin. I was simply looking for one that can filter out a category out of my home page and RSS, so it’s working perfectly with my WP v.2.2.1 blog.

  319. ilia Says:

    ruralmoon,

    I’m trying to add your code but it comes back with error. Is it suppose to work under Wp v.2.2.1?

  320. Tim Says:

    same question as above (haven’t tried it yet though beacause me renting a host depends on this plugin working…)

  321. notoriousxl Says:

    If I activate it under Wordpress 2.2, my “Categories” page (based on the archive template) looks strange: the categories’ hierarchy is modified.

  322. notoriousxl Says:

    sorry, in my last post I forgot a “.2″… is “Wordpress 2.2.2″ :P

  323. Bruce Says:

    Thanks Rich for this great plugin,
    i’m goint to install it right now
    ;)
    Bruce

  324. melanie west Says:

    i have installed & activated it without any problems. unchecked the categories i do not want to be show up but it doesn’t seem to work. i check my website from another computer and in another browser just to make sure & all the categories are still there. is there anything i missed?

    thanks!

  325. Rene Says:

    Seems a nice plugin, but is there any chance an update will be made compatible with WP 2.2.2 ? (also widget-compatible)

  326. Rich Says:

    Probably not. Wordpress has become so aggressive with new releases (a good thing, in general) that I am unable to keep up with them. From the comments, it appears it still works for a lot of folks, so while no longer “perfect,” it remains of value.

  327. mark Says:

    Sorry, I’m a simple guy and don’t understand all the finer coding things. But is there a way of getting rid of the post counts and arrow placeholders - see www.theworldsbesthomepage.com for example of what I am left with. Thanks.

  328. Ralf Says:

    I have greatly enjoyed using this plugin (and its predecessor) for the last ten months.

    Unfortunately though, the upgrade to WordPress 2.2.2 and Gengo multilingual plugin caused Cat_Vis to break. I cannot see individual post pages anymore. I can’t use the previous posts button etc…

    There’s no going back now. I thus have to stop using category visibility :(

    Finding a good replacement was difficult as the most obvious alternatives acted on a per-post basis. That means that I would need to edit all my 60 private posts now, and also remember to assign rights to EACH new private post now and forever. What a hassle!

    Anyway, I found a replacement. Not as good, but at least it’s error free and it lets one assign CATEGORY access rights to anonymous readers and something called “new users” (?). Testint about to begin…

    It’s called category access and it’s available at:
    http ://www.coppit.org/code/

    Hope you too find it usefull.

    ps. I am not related in any way to the author of that plugin.

  329. Manele Says:

    I have just installed your plugin on a new blog I am doing and first - thank you!

  330. Frank Says:

    b10 works great on my site! thanks a bunch

  331. Frank Says:

    ok spoke a bit too soon. it works beautifully until you try and go to an individual post. then i get this error “WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘ORDER BY post_date DESC’ at line 1]
    SELECT wp_posts.* FROM wp_posts WHERE 1=1 AND YEAR(post_date)=’2007′ AND MONTH(post_date)=’2′ AND DAYOFMONTH(post_date)=’25′ AND post_name = ‘gap’ AND (post_type = ‘post’) AND ((wp_catt_visibility.archives=1 AND wp_catt_visibility.cv_user_level<=’10′) OR post_type=’page’ OR wp_catt_visibility.catt_ID IS NULL ORDER BY post_date DESC”
    any ideas on how to fix it?

  332. Jenn Says:

    Getting the same error as Frank above. Post pages return that error and can’t be displayed when the plugin is activated (the most recent beta).

  333. atombong Says:

    I’m getting the same error, Frank. I’d love to get this working… any help would be appreciated!

  334. robs Says:

    I would like to have how default all the categories
    hidden;
    can you suggest which is the cahnge that I must to do?

    Now by default in admin all the categories are
    checked and if you remove checked you can
    hidden categories;

    I would like to have the opposite:
    I think there are two solutions:
    -1 by default if all is checked then the categories
    are hidden and if I remove check I can see it;
    or
    2 by default all isn’t checked and I not see
    categories; only if I check I see categories;

    I think found the parameter for to change but
    have always problem that if one click same time button submit changes all checked switch at every
    click;
    can help

  335. Reese Hopkins Says:

    I just converted over to WP2.3 and I got this error when running the plugin

    WordPress database error: [Table ‘thetinym_wordpress.wp_post2cat’ doesn’t exist]
    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) 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) ORDER BY post_date DESC LIMIT 0, 7

    Any thoughts?

  336. Joe Says:

    If anyone finds a way to make this work with WP2.3 please post here, I’m desperate to find a plugin with this functionality for WP 2.3!

  337. Hans Says:

    Hi,

    Just upgraded to 2.3 and unfortunately I get the following error (top of page):

    WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘ORDER BY post_date DESC’ at line 1]
    SELECT wp_posts.* FROM wp_posts WHERE 1=1 AND MONTH(post_date)=’6′ AND DAYOFMONTH(post_date)=’18′ AND post_name = ‘the-colonial-inn’ AND post_type = ‘post’ AND ((wp_catt_visibility.archives=1 AND wp_catt_visibility.cv_user_level<=’10′) OR post_type=’page’ OR wp_catt_visibility.catt_ID IS NULL ORDER BY post_date DESC

    and in the sidebar:
    WordPress database error: [Table ‘leisurep_wordpress.wp_categories’ doesn’t exist]
    SELECT * FROM wp_categories LEFT JOIN wp_catt_visibility ON (wp_categories.cat_ID = wp_catt_visibility.catt_ID) ORDER BY wp_categories.cat_name

    I understand the categories table doesn’t exist anymore but how do I fix it, what to do?

    Thanks

    Hans

  338. NoName Says:

    Reese Hopkins > i have the same error:-(

  339. Zadro Says:

    i need this for WP2.3 Please! :-/

  340. Rich Says:

    Sorry, no version for 2.1 or later.

    As noted in the download section above, “Alas, everyone wants to know when the new version will be ready. It probably won’t. As I was testing the 2.1 version WP released 2.2 and I realized I can’t keep up. Still, some folks are finding this very useful, so I’ll keep it here for you and maybe someone else will pick up the ball.”

  341. bvo Says:

    I’d like a 2.3 version too!! Anyone taking over from Rich?

  342. Cosme Faé Says:

    i need this plugin for WP2.3 too! =/

  343. ProjektSeven Says:

    Dudes: I just spent an hour or two and fixed this thing to to work with WordPress 2.3, so if you want it, email me: biotechnique (at) gmail (dot) com

  344. Chuck Says:

    This is one of those plug-ins that I would be happy to pay for. Bet there are a few others who would too!

  345. elfox Says:

    i need this plugin for wp2.3 thx.

  346. Matt Davies Says:

    This is a great plugin! I REALLY WANT IT TO WORK IN 2.3! ProjektSeven, why not submit your update to this site? Loads of us want it!

    Matt

  347. ProjektSeven Says:

    Okay Kids, I said I had it, and I will a) email those who emailed me (tonight), and b) post it on some domain somewhere so that you can grab it tonight. It is missing some functionality because I didn’t need it for my purposes, but if you want to fix it it’s all still there…I don’t have the time.

    Open source rules; people who make you pay for plugins should be spammed.

  348. kapeka Says:

    ProjektSeven:
    Where is that “some domain somewhere”?
    I’m heavily interested in a fixed plugin fpr WP 2.3.
    Do you still accept emails?

    thx kp

  349. resim Says:

    great plugin and it is working with wordpress2.3
    thanks…

  350. Philipp Says:

    Hey!

    The Entries in the RSS are duplicated, also with the Beta10. But the rest is fine. www.engarde.at

  351. stephen Says:

    Wait, most are saying it does not work. One person says it does work (resim) and one saying they managed to fix it.

    My site design depends on this plugin, so i’m gonna have to be sure its working before I upgrade to 2.3. ;)

  352. Jabba Says:

    Wordpress 2.3 handles categories differently. They are don’t have their own table in the database anymore. This plugin won’t work with 2.3 until somebody fixes it.

    If you have a fixed version can you please post the updates here.

  353. Maxime Says:

    (…still waiting for the WP2.3 fixed version…)

  354. ProjektSeven Says:

    Here is the link to a working version!!

    http://www.tastycornbread.com/category-plugin/

    Enjoy!

  355. Как накрутить feedburner Says:

    ..waiting for the WP2.3 fixed version) too

  356. Mike Says:

    please fix it :)

  357. Stephen Says:

    Thanks to ProjektSeven for getting this (mostly) working on Wordpress 2.3 (found here). It will work for what I need on http://www.ponderplace.com. :)

    Also, for whatever reason ProjektSeven does not give a description or any explanation on his/her/their website. The following can be found in the plugin’s .php file.

    **** Start ProjektSeven ****

    I basically made the changes I needed to get this to hide certain categories on a few of my WP 2.3 based sites. Some
    functionality is disabled, but can probably be enabled with a few tweaks to the code - I just didn’t need it,
    and didn’t have time, so I didn’t make those changes. There may be bugs, and if there are you can email me at –hidden– and if I have time I can take a look at them…

    What I needed it to do: Hide a certain number of categories on all pages that I wanted to be able to link to manually.

    I noted below where I completely disable functions or lines that were useless for my purposes. Good Luck.

    **** End ProjektSeven ****

  358. demir21 Says:

    “WordPress veritabanı hatası: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘ORDER BY post_date DESC’ at line 1]
    SELECT wp_posts.* FROM wp_posts WHERE 1=1 AND ID = 9 AND (post_type = ‘post’) AND ((wp_catt_visibility.archives=1 AND wp_catt_visibility.cv_user_level<=’0′) OR post_type=’page’ OR wp_catt_visibility.catt_ID IS NULL ORDER BY post_date DESC “

    i have this problem
    what can i do????

  359. tacoma sun Says:

    ACK! Why in the hell isn’t this feature standard with WordPress?!

  360. Zyama Says:

    Demir21, kulladığın WordPress sürümü 2.3 değil ise http://ryowebsite.com/wp-content/catvis-2.1beta9.zip kullan, bu hata o zaman çıkmaz.

  361. Webmaster Marty Says:

    Thank you very much, i’m going to impliment this right away. Been looking for this for hours, totally grateful.

    Marty.

  362. Geironimo Says:

    Hi everybody! I noticed that ProjektSeven’s changes did not work on my latest wp installation ver 2.3.1 But I found another plugin that works and does pretty much the same thing over here:
    http://wordpress.org/extend/plugins/advanced-category-excluder/

    Hope this is helpful to someone :o)

  363. ChrisJB Says:

    Hi there,

    I get an error after installing and activating the plugin. After I activate I get this message appearing at the top of my website:

    WordPress database error: [Table ‘gogreen.wp_post2cat’ doesn’t exist]….

    …this continues with lots more code.

    I also get the same code displaying where my category links should display.

    In the Admin, on the Category Visibility page I get this:

    WordPress database error: [Table ‘gogreen.wp_categories’ doesn’t exist]
    SELECT * FROM wp_categories ORDER BY cat_name

    I’m using 2.3.1 and I get the same message with your latest version and your beta 10 version. Any ideas?

    Thanks for your help by the way.

    P.S if you want me to email you the rest of the code let e know.

  364. Rich Says:

    ChrisJB: This plugin is for WP 2.0.

    NOT for 2.1, 2.2,2.3 or anything later. Some folks might find it workable for their situation. Most won’t.

  365. Atreus Says:

    Check out http://www.tastycornbread.com/category-plugin/
    Updated for 2.3!

  366. ChrisJB Says:

    Thanks Atreus I’ll check that out.

  367. ChrisJB Says:

    That worked a treat Altreus! Thanks very much.

  368. harchew Says:

    I installed the plugin from http://www.tastycornbread.com/category-plugin/. A blank page appear when I click on manage > Category Visibility. Any idea whats going on or any area I need to configure? Btw I am currently using wp2.3.1….

  369. wmwebtr ödüllü seo yarışması Says:

    it is not working on wp2.3 but i will try other plugin.

  370. SEO Houston Says:

    I hope you keep this plugin going as it rocks. Anyone getting it working in 2.3.1?

  371. Edie Says:

    Hello,

    I have instaled this plugin http://www.tastycornbread.com/category-plugin/ but it does not hide one of my categories from homepage. Any advice?

    Thank you for reply!

  372. CRISTOBAL Says:

    WHEN ITS GOIN´ TO WORK ON wp 2.3 !

    PLEASE, WORK ON THAT MASTAH

  373. Rich Says:

    It’s NOT going to work on 2.3. Period. Because development has stopped. It’s here for those who use compatible versions.

    (YOU could always download it and REVISE IT YOURSELF to work.)

  374. KAPS Says:

    The http://www.tastycornbread.com/category-plugin/ link is now dead.. does anyone have a copy of that plugin that they could post up somewhere?

    Thanks..

    bs

  375. Oba Says:

    I downloaded this plugin. Thank you.

  376. Caped Crusader Says:

    Does any one have a LINK for a version that works with WP 2.3 ?

  377. Leigh Says:

    Hi there,

    Is it possible to use your plugin to restrict a wordpress user from selecting a certain category when making a post?

    Regards,

    Leigh.

  378. Rich Says:

    Leigh,

    I think not.

  379. iPeat Says:

    I have one but I have been dragging my feet in posting it, because it is not fully bug tested. I’ll put it up tonight though.

  380. iPeat Says:

    It is up, download and watch for updates here. http://ipeat.com/?page_id=91

  381. Richard Says:

    Great plugin.

    However, I can’t get 1.0.0e to work with the Filosofo Home Page Control plugin - e.g. see http://www.wolverhamptonclc.co.uk/blog. This is set as the blog section in Home Page control options, and the categories “News” and “Podcast” hidden from Front in options for Category Visibility.

    However, those categories still show on the blog page.

    Any ideas for how I can get it to work?

  382. Richard Says:

    Sorted my own problem:

    I replaced:

    if (is_home())

    on line 245 with

    if (!is_archive()&& !is_category() && !is_feed() && !is_search() &&!is_single())

    i.e. Use a process of elimination to identify the front page.

  383. baron Says:

    hi there.com plugin but :

    Does anybody know if tis script is compatible with Wordpress 2.5?

    Thanks in advance for any help on this!

    turkbaron

  384. Rich Says:

    This plugin is used with WP 2.0.x only… not later versions.

    And therefore we’ve closed comments.

Get our ‘Minute of Magic’ Newsletter! FREE!

Name: Email: