Changeset 7806
- Timestamp:
- 10/31/2018 03:02:42 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-performance-optimizations.php
r6564 r7806 39 39 // Disable post meta key lookup, see https://core.trac.wordpress.org/ticket/33885. 40 40 add_filter( 'postmeta_form_keys', '__return_empty_array' ); 41 42 // Disable canonical redirects for short post_names 43 add_filter( 'template_redirect', array( $this, 'maybe_disable_404_canonical' ), 9 ); 44 45 } 46 47 /** 48 * Disables Canonical redirects on 404 pages when a short (<5char) name is provided. 49 * 50 * This is used to avoid really bad queries in redirect_guess_404_permalink() on urls such as: 51 * https://wordpress.org/support/topic/test/*1* 52 */ 53 public function maybe_disable_404_canonical() { 54 if ( is_404() && get_query_var( 'name' ) && strlen( get_query_var( 'name' ) ) < 5 ) { 55 remove_filter( 'template_redirect', 'redirect_canonical' ); 56 } 41 57 } 42 58
Note: See TracChangeset
for help on using the changeset viewer.