Changeset 8288
- Timestamp:
- 02/20/2019 04:08:04 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-makehome/functions.php
r7795 r8288 15 15 add_action( 'pre_get_posts', 'make_query_mods' ); 16 16 function make_query_mods( $query ) { 17 if ( ! is_admin() && $query->is_main_query() && $query->is_home() ) 17 if ( ! is_admin() && $query->is_main_query() && $query->is_home() ) { 18 18 $query->set( 'posts_per_page', 1 ); 19 } 20 21 // There's nothing worth searching for on this site. 22 if ( ! is_admin() && $query->is_main_query() && $query->is_search() ) { 23 $query->set_404(); 24 } 19 25 } 26 27 add_filter( 'the_posts', function( $posts, $query ) { 28 // Ensure all non-post routes 404, as this site isn't like most others. 29 if ( 30 ( ! is_admin() && $query->is_main_query() && ! $posts ) || 31 ( ! is_admin() && $query->is_main_query() && $query->is_post_type_archive( 'meeting' ) && $query->get('paged') > 1 ) // Pagination on the query is explicitly disabled, so this doens't 404 32 ) { 33 $query->set_404(); 34 status_header( 404 ); 35 nocache_headers(); 36 } 37 38 return $posts; 39 }, 10, 2 ); 20 40 21 41 add_filter('post_class','make_home_site_classes', 10, 3);
Note: See TracChangeset
for help on using the changeset viewer.