WordPress.org

Ready to get started?Download WordPress

Forums

I want to limit access to a specific category (28 posts)

  1. billdennis5
    Member
    Posted 8 years ago #

    I would like to prevent visitors from reading posts in a specific category. I'll delete them if I have to, but I would rather make them unavailable.

    If there any way to do this ex post facto? I've looked at the plugins and couldn't find one that worked. I'm still using WP 1.5.2

    Thank you in advance for any assistance.

  2. ladydelaluna
    Member
    Posted 8 years ago #

    well first, you should definitely upgrade to 2.0.2 - to at least protect you from some major security issues known in 1.5

    but this is the code you want to use:

    <?php wp_list_cats('sort_column=name&optioncount=1&exclude=10, 15'); ?>

    and change the 10,15 to the category numbers you want to exclude

    any time you wish to change the way categories are displayed, try the codex: http://codex.wordpress.org/Template_Tags/wp_list_cats

  3. billdennis5
    Member
    Posted 8 years ago #

    Thanks for the advice. I'll do it asap. But what i was wanting was a way to make the posts completely invisible. Even delete them.

    You understand that I have several hundred posts in this category.

    I tried the plugin "batch category" but it seemed incompatible with my installation.

  4. ladydelaluna
    Member
    Posted 8 years ago #

    well, if nothing's linking to the category, then no one can see the posts inside it.

    and maybe if you do the upgrade first, and then try the plugin, you'll have more luck?

  5. billdennis5
    Member
    Posted 8 years ago #

    You really are pushing the upgrade, huh?

    ;-)

    I just worry to death about a glitch in the upgrade destroying all my hard work over four years.

  6. moshu
    Member
    Posted 8 years ago #

    billdennis5,
    what is your WP version? The batch-category has never been updated for newer WP versions. It worked in 1.2.x and if you search a lot (sorry) you can find somewhere in the forum a reference/link to a version that works with WP 1.5.x

  7. billdennis5
    Member
    Posted 8 years ago #

    I am using WP 1.5.2.

    When I activate the plugin, I get an error message.

    At this point, I am willing to just delate all posts in these particular categories, but we're talking about 400 plus posts.

  8. moshu
    Member
    Posted 8 years ago #

  9. billdennis5
    Member
    Posted 8 years ago #

    When I activate, my administration pages show the following error:

    Warning: Cannot modify header information - headers already sent by (output started at /home/peoriapu/public_html/blogpeoria/wp-content/plugins/batch-access.php:11) in /home/peoriapu/public_html/blogpeoria/wp-admin/admin.php on line 10

    Warning: Cannot modify header information - headers already sent by (output started at /home/peoriapu/public_html/blogpeoria/wp-content/plugins/batch-access.php:11) in /home/peoriapu/public_html/blogpeoria/wp-admin/admin.php on line 11

    Warning: Cannot modify header information - headers already sent by (output started at /home/peoriapu/public_html/blogpeoria/wp-content/plugins/batch-access.php:11) in /home/peoriapu/public_html/blogpeoria/wp-admin/admin.php on line 12

    Warning: Cannot modify header information - headers already sent by (output started at /home/peoriapu/public_html/blogpeoria/wp-content/plugins/batch-access.php:11) in /home/peoriapu/public_html/blogpeoria/wp-admin/admin.php on line 13

    The issue may be due to the fact that I don't have my blog located in the main directory of my domain, but in a subdirectory called "blogpeoria" i.e. "peoriapundit.com/blogpeoria"?

  10. billdennis5
    Member
    Posted 8 years ago #

    No, I am not.

    I will give it a try.

    Thank you.

  11. moshu
    Member
    Posted 8 years ago #

  12. ladydelaluna
    Member
    Posted 8 years ago #

    not pushing the upgrade for any other reason than it's effectiveness. :)

    i just did an upgrade from 1.5 to 2.0.2 a few hours ago... if you follow the guides, you're sure not to have any issues. (rule #1 is backing it all up first!)

  13. billdennis5
    Member
    Posted 8 years ago #

    Well, I did it.
    I followed the instructions and went to this page:

    http://peoriapundit.com/blogpeoria/wp-admin/batch-categories.php

    All I got was a page showing the code.

  14. billdennis5
    Member
    Posted 8 years ago #

    NOW I'm getting the following error message:

    Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /home/peoriapu/public_html/blogpeoria/wp-admin/batch-categories.php on line 2

    Parse error: syntax error, unexpected T_STRING in /home/peoriapu/public_html/blogpeoria/wp-admin/batch-categories.php on line 2

  15. ladydelaluna
    Member
    Posted 8 years ago #

    okay, so check those files for those errors... it's saying there's a \ where there shouldn't be one in that file... on line 2.

  16. billdennis5
    Member
    Posted 8 years ago #

    Yeah, a whole buch of 'em:

    I took them all out and I'm getting the exact same error msg.

  17. billdennis5
    Member
    Posted 8 years ago #

    Maybe there's a way to delete all posts with these categories from my database?

    It's either that or take a day off work and manually delate 400 plus posts.

  18. ladydelaluna
    Member
    Posted 8 years ago #

    why are they in there in the first place though? wordpress didn't put them there, i'm sure.... everything web related uses forward slashes... /////
    your computer categorizes things with backslashes \\\\\

    i'm confused - they shouldn't be there.

  19. ladydelaluna
    Member
    Posted 8 years ago #

    okay wait.

    you did the upgrade to 2.0.2?
    is that plugin 2.0 compatible?

  20. billdennis5
    Member
    Posted 8 years ago #

    no. I started using the supposedly WP 1.5.2 compatible plugin.

    The plugin file used the slashes, to make comments.

  21. mylagoon
    Member
    Posted 8 years ago #

    Take a read of this:
    http://wordpress.org/support/topic/17801?replies=10

    I beleive the methods described on quick glance will work if you have 1.5.2 running. If you've upgraded then you'll need to change the SQL statement.

    "While deleting ALL posts is a simple thing to do, what if I want to delete all of the posts in a particular category, but retain the category?"

    Going back to the SQL thing, this slightly complicated SQL statement will do what you're after:

    DELETE FROM wp_posts, wp_post2cat USING wp_posts, wp_post2cat WHERE ID=post_id AND category_id="100";

    The final value ("100") would be the numeric ID of the category to delete the posts from. If not using the default table prefix (wp_), you'll have to modify the table references in the statement to reflect that.

  22. billdennis5
    Member
    Posted 8 years ago #

    Thank you. You are dealing with a real newbie here.

    Where do I run this statemednt using phpMyAdmin?

  23. mylagoon
    Member
    Posted 8 years ago #

    In phpMyAdmin select your database from the drop-down box. The page should now refresh. On the top menu bar of the website click on 'SQL'.

    On the page it takes you to there is a large text box, input your SQL statement in there and click go.

  24. billdennis5
    Member
    Posted 8 years ago #

    Mylagoon: It worked.

    Thank you.

  25. ladydelaluna
    Member
    Posted 8 years ago #

    *whew*!
    Glad to see you got some help, Bill! :)

  26. fumatul
    Member
    Posted 8 years ago #

    i got the same problem with preventing visitors to read some personal posts in a specific category... still haven't managed to fix it!

  27. ladydelaluna
    Member
    Posted 8 years ago #

    spam, anyone?

  28. billdennis5
    Member
    Posted 8 years ago #

    No thanks. I have plenty.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags