Trying to Block Some Posts from the Front Page

Calling all WordPress Gurus.
I am trying to block posts from a category from showing up on the front page. I tracked the category number down and put this code at the end of my functions.php file, but they are still showing up.

PHP:
  1. // remove from home page
  2. function exclude_category($query) {
  3. if ( $query->is_home ) {
  4. $query->set(‘cat’, ‘-11');
  5. }
  6. return $query;
  7. }
  8. add_filter(‘pre_get_posts’, ‘exclude_category’);
  9. // remove from home page

Am I supposed to put a call to this in my Index.php? Or am I missing something? Did they change how this works with WP 3?

About Brian A. Thomas

I am the father of Ari and Sidd. I am the owner and administrator of this site.
Site News

Leave a Reply

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

*

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