Changeset 3377
- Timestamp:
- 06/15/2016 06:54:47 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-directory.php
r3376 r3377 32 32 add_action( 'template_redirect', array( $this, 'redirect_hidden_plugins' ) ); 33 33 add_action( 'template_redirect', array( $this, 'prevent_canonical_for_plugins' ), 9 ); 34 add_action( 'template_redirect', array( $this, 'redirect_old_plugin_ tabs' ) );34 add_action( 'template_redirect', array( $this, 'redirect_old_plugin_urls' ) ); 35 35 add_filter( 'query_vars', array( $this, 'filter_query_vars' ) ); 36 36 … … 573 573 574 574 /** 575 * Handles a redirect for the old /$plugin/$tab_name/ URLs 576 */ 577 function redirect_old_plugin_tabs() { 575 * Handles a redirect for the old /$plugin/$tab_name/ URLs and search.php 576 */ 577 function redirect_old_plugin_urls() { 578 // Handle a redirect for /$plugin/$tab_name/ to /$plugin/#$tab_name 578 579 if ( get_query_var( 'redirect_plugin_tab' ) ) { 579 580 wp_safe_redirect( site_url( get_query_var( 'redirect_plugin_tab' ) ) ); 581 die(); 582 } 583 584 // We don't have attachments, but /$plugin/random() will hit this check. 585 if ( is_404() ) { 586 // [1] => plugins [2] => example-plugin-name [2..] => random() 587 $plugin_slug = explode( '/', $_SERVER['REQUEST_URI'] )[2]; 588 if ( $plugin = self::get_plugin_post( $plugin_slug ) ) { 589 wp_safe_redirect( get_permalink( $plugin->ID ) ); 590 die(); 591 } 592 } 593 594 // If it's an old search query, handle that too. 595 if ( 'search.php' == get_query_var( 'name' ) && isset( $_GET['q'] ) ) { 596 wp_safe_redirect( site_url( '/search/' . urlencode( wp_unslash( $_GET['q'] ) ) . '/' ) ); 580 597 die(); 581 598 }
Note: See TracChangeset
for help on using the changeset viewer.