WordPress.org

Make WordPress Core

Changeset 5916


Ignore:
Timestamp:
08/22/2007 06:03:26 PM (14 years ago)
Author:
ryan
Message:

posts_results and posts_selection hooks. fixes #4799

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/query.php

    r5912 r5916  
    11291129
    11301130        // Apply post-paging filters on where and join.  Only plugins that
    1131         // manipulate paging queries should use these hooks.
     1131        // manipulate paging queries should use these hooks.   
     1132
     1133        // Announce current selection parameters.  For use by caching plugins.
     1134        do_action( 'posts_selection', $where . $groupby . $q['orderby'] . $limits . $join );
     1135
    11321136        $where = apply_filters('posts_where_paged', $where);
    11331137        $groupby = apply_filters('posts_groupby', $groupby);
     
    11361140        $join = apply_filters('posts_join_paged', $join);
    11371141        $orderby = apply_filters('posts_orderby', $q['orderby']);
     1142        if ( !empty( $orderby ) )
     1143            $orderby = 'ORDER BY ' . $orderby;
    11381144        $distinct = apply_filters('posts_distinct', $distinct);
    11391145        $fields = apply_filters('posts_fields', "$wpdb->posts.*");
     
    11431149            $found_rows = 'SQL_CALC_FOUND_ROWS';
    11441150
    1145         $request = " SELECT $found_rows $distinct $fields FROM $wpdb->posts $join WHERE 1=1 $where $groupby ORDER BY $orderby $limits";
     1151        $request = " SELECT $found_rows $distinct $fields FROM $wpdb->posts $join WHERE 1=1 $where $groupby $orderby $limits";
    11461152        $this->request = apply_filters('posts_request', $request);
    11471153
    11481154        $this->posts = $wpdb->get_results($this->request);
     1155        // Raw results filter.  Prior to status checks.
     1156        $this->posts = apply_filters('posts_results', $this->posts);
    11491157
    11501158        if ( $this->is_comment_feed && $this->is_singular ) {
Note: See TracChangeset for help on using the changeset viewer.