Changeset 5719 for sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-directory.php
- Timestamp:
- 07/26/2017 02:45:28 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-directory.php
r5718 r5719 36 36 add_filter( 'term_link', array( $this, 'filter_term_link' ), 10, 2 ); 37 37 add_action( 'pre_get_posts', array( $this, 'pre_get_posts' ) ); 38 add_filter( 'found_posts', array( $this, 'filter_found_posts' ), 10, 2 ); 38 39 add_filter( 'rest_api_allowed_post_types', array( $this, 'filter_allowed_post_types' ) ); 39 40 add_filter( 'pre_update_option_jetpack_options', array( $this, 'filter_jetpack_options' ) ); … … 799 800 $wp_query->query_vars['meta_key'] = '_active_installs'; 800 801 } 802 } 803 804 /** 805 * Filter to limit the total number of found posts in browse queries. 806 * Stops search crawlers from paginating through the entire DB. 807 */ 808 public function filter_found_posts( $found_posts, $wp_query ) { 809 if ( isset( $wp_query->query['browse'] ) && in_array( 'plugin', $wp_query->query_vars['post_type'] ) ) { 810 return min( $found_posts, 99 * $wp_query->query_vars['posts_per_page'] ); // 99 pages 811 } 812 813 return $found_posts; 801 814 } 802 815
Note: See TracChangeset
for help on using the changeset viewer.