WordPress.org

Make WordPress Core

Ticket #8022: postbypost_filters.patch

File postbypost_filters.patch, 781 bytes (added by kevinB, 9 years ago)

getarchives_distinct, getarchives_fields filters for postbypost archive type

  • general-template.php

     
    855855                }
    856856        } elseif ( ( 'postbypost' == $type ) || ('alpha' == $type) ) {
    857857                $orderby = ('alpha' == $type) ? "post_title ASC " : "post_date DESC ";
    858                 $query = "SELECT * FROM $wpdb->posts $join $where ORDER BY $orderby $limit";
     858               
     859                $distinct = apply_filters('getarchives_distinct', "", $r);
     860                $fields = apply_filters('getarchives_fields', "*", $r);
     861               
     862                $query = "SELECT $distinct $fields FROM $wpdb->posts $join $where ORDER BY $orderby $limit";
    859863                $key = md5($query);
    860864                $cache = wp_cache_get( 'wp_get_archives' , 'general');
    861865                if ( !isset( $cache[ $key ] ) ) {