diff --git wordpress.org/public_html/wp-content/plugins/wporg-bbp-redirect/wporg-bbp-redirect.php wordpress.org/public_html/wp-content/plugins/wporg-bbp-redirect/wporg-bbp-redirect.php
index 474f3996a..61de4fbc8 100644
|
|
class WPORG_bbPress_Old_Id_Redirect { |
29 | 29 | public function __construct() { |
30 | 30 | // Add action to template redirect after wp_old_slug_redirect. |
31 | 31 | add_action( 'template_redirect', array( $this, 'maybe_redirect' ), 11 ); |
| 32 | add_filter( 'redirect_canonical', array( $this, 'no_redirect_on_404' ), 10, 2 ); |
| 33 | } |
| 34 | |
| 35 | public function no_redirect_on_404( $redirect_url, $requested_url ) { |
| 36 | global $wp_query; |
| 37 | |
| 38 | if ( is_404() && 0 === strpos( $wp_query->query['pagename'], bbp_get_root_slug() ) ) { |
| 39 | return null; |
| 40 | } |
| 41 | |
| 42 | return $redirect_url; |
32 | 43 | } |
33 | 44 | |
34 | 45 | public function maybe_redirect() { |