How to exclude a particular category in wordpress using category name?

you can exclude a category from your posts by doing this code:

<?php $query_posts(‘cat=-4′); ?>

but i want to replace category ID with its category name. How do i do that?

can anyone help me please.


Comments

2 Responses to “How to exclude a particular category in wordpress using category name?”

  1. aaron_nimocks on August 24th, 2010 9:28 am

    Didn’t test it but one of the paramenters you can use is category_name and the – means exclude. So you should be able to do something like.

    query_posts(‘category_name=-Your Category Name’);

  2. j k on August 24th, 2010 9:28 am

    I believe you need to use the cat id, but I don’t know for sure. Best bet is to ask at the wordpress.org forums. Someone there can definitely tell you yes or no, as opposed to folks guessing.

    http://wordpress.org/support/

Powered by Yahoo! Answers