Welcome, visitor! Log in
 

Source View: posts_where

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN  (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

  • Action hooks look like this: do_action( "hook_name" )
  • Filter hooks look like this: apply_filters( "hook_name", "what_to_filter" ).

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
604                 $where .= " AND (post_status != 'static')";
605            } else {
606                 $where .= " AND (post_status = 'publish'";
607  
608                 if (isset($user_ID) && ('' != intval($user_ID)))
609                      $where .= " OR post_author = $user_ID AND post_status != 'draft' AND post_status != 'static')";
610                 else
611                      $where .= ')';                    
612            }
613  
614            if (! $this->is_attachment )
615                 $where .= " AND post_status != 'attachment'";
616  
617            // Apply filters on where and join prior to paging so that any
618            // manipulations to them are reflected in the paging by day queries.
619            $where = apply_filters('posts_where', $where);
620            $join = apply_filters('posts_join', $join);
621  
622            // Paging
623            if (empty($q['nopaging']) && ! $this->is_single && ! $this->is_page) {
624                 $page = abs(intval($q['paged']));
625                 if (empty($page)) {
626                      $page = 1;
627                 }
628  
629                 if (($q['what_to_show'] == 'posts')) {
630                      $q['offset'] = abs(intval($q['offset']));
631                      if ( empty($q['offset']) ) {
632                           $pgstrt = '';
633                           $pgstrt = (intval($page) -1) * $q['posts_per_page'] . ', ';
634                           $limits = 'LIMIT '.$pgstrt.$q['posts_per_page'];