Changeset 11166 for sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-themes/functions.php
- Timestamp:
- 08/03/2021 04:47:26 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-themes/functions.php
r11165 r11166 67 67 wp_safe_redirect( home_url( '/search/' . urlencode( get_query_var( 's' ) ) . '/' ), 301 ); 68 68 die(); 69 } 70 71 // Handle 404 pages where it's a singular theme followed by junk, for example, /themes/twentyten/junk/input/ 72 if ( is_404() ) { 73 $path = parse_url( $_SERVER['REQUEST_URI'], PHP_URL_PATH ); 74 if ( preg_match( '!^/themes/([^/]+)/.+!i', $path, $m ) ) { 75 $posts = get_posts( [ 76 'name' => $m[1], 77 'post_type' => 'repopackage', 78 'post_status' => 'publish' 79 ] ); 80 81 if ( $posts ) { 82 wp_safe_redirect( get_permalink( $posts[0] ), 301 ); 83 die(); 84 } 85 } 69 86 } 70 87
Note: See TracChangeset
for help on using the changeset viewer.