WordPress.org

Ready to get started?Download WordPress

Forums

$query stopped working properly after upgrade to 3.1 (2 posts)

  1. slobizman
    Member
    Posted 3 years ago #

    The following function (in Thesis, not that it matters) stopped working when I upgraded to 3.1. It is supposed to not show certain posts on the home page and other pages. Since the upgrade it now does. Any ideas as to what changed?

    [Code moderated as per the Forum Rules. Please use the pastebin]

  2. slobizman
    Member
    Posted 3 years ago #

    I figured it out. I'll post the change for anyone else:

    if ($query->is_home ) {
         $query->set('category__not_in', array(226,317));
       } elseif ($query->is_paged ) {
          $query->set('category__not_in', array(226,317));
       } elseif ($query->is_search ) {
          $query->set('category__not_in', array(226));
       } elseif ($query->is_archive ) {
          $query->set('category__not_in', array(226));
       } elseif ($query->is_feed ) {
          $query->set('category__not_in', array(226));
       }
       return $query;

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags