Changeset 8577 for sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-performance-optimizations.php
- Timestamp:
- 04/03/2019 06:48:36 AM (5 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
r8468 r8577 36 36 // Redirect (.+)/page/[01]/ and (.+)?paged=[01] to $1 37 37 add_action( 'bbp_template_redirect', array( $this, 'redirect_page_zero_one' ) ); 38 39 // Redirect Attachments to their file 40 add_action( 'bbp_template_redirect', array( $this, 'redirect_attachments' ) ); 38 41 39 42 // REST API. … … 156 159 exit; 157 160 } 161 } 162 } 163 164 public function redirect_attachments() { 165 if ( is_attachment() ) { 166 $url = wp_get_attachment_url( get_queried_object_id() ); 167 if ( ! $url ) { 168 return; 169 } 170 171 if ( 172 function_exists( 'jetpack_photon_url' ) && 173 class_exists( '\Jetpack' ) && 174 method_exists( '\Jetpack', 'get_active_modules' ) && 175 in_array( 'photon', \Jetpack::get_active_modules() ) 176 ) { 177 $url = jetpack_photon_url( $url ); 178 } 179 180 wp_redirect( $url, 301 ); 181 exit; 158 182 } 159 183 }
Note: See TracChangeset
for help on using the changeset viewer.