Changeset 11121 for sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-patterns/functions.php
- Timestamp:
- 07/16/2021 08:58:19 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-patterns/functions.php
r11117 r11121 14 14 15 15 add_filter( 'archive_template', __NAMESPACE__ . '\use_index_php_as_template' ); 16 17 add_filter( 'pre_handle_404', __NAMESPACE__ . '\bypass_404_page', 10, 2 );18 19 16 add_action( 'template_redirect', __NAMESPACE__ . '\rewrite_search_url' ); 20 17 … … 227 224 228 225 /** 229 * Handle a possible 404 page when viewing patterns, which might happen if the JS pagination is230 * different than the WP default.231 *232 * @param bool $preempt Whether to short-circuit default header status handling. Default false.233 * @param WP_Query $wp_query WordPress Query object.234 * @return bool235 */236 function bypass_404_page( $preempt, $wp_query ) {237 if ( isset( $wp_query->query_vars['post_type'][0] ) && POST_TYPE === $wp_query->query_vars['post_type'][0] ) {238 return true;239 }240 return $preempt;241 }242 243 /**244 226 * Get the full, filtered content of a post, ignoring more and noteaser tags and pagination. 245 227 *
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)