Changeset 8229
- Timestamp:
- 02/12/2019 05:21:45 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-hooks.php
r8225 r8229 16 16 add_filter( 'bbp_map_meta_caps', array( $this, 'disallow_editing_past_lock_time' ), 10, 4 ); 17 17 add_filter( 'redirect_canonical', array( $this, 'disable_redirect_guess_404_permalink' ) ); 18 add_filter( 'old_slug_redirect_post_id', array( $this, 'disable_wp_old_slug_redirect' ) ); 18 19 add_action( 'template_redirect', array( $this, 'redirect_update_php_page' ) ); 19 20 add_filter( 'wp_insert_post_data', array( $this, 'set_post_date_gmt_for_pending_posts' ) ); … … 207 208 208 209 return $redirect_url; 210 } 211 212 /** 213 * Disable wp_old_slug_redirect() for hidden topics. 214 * 215 * Prevents Spam, Pending, or Archived topics that the current user cannot view 216 * from performing a redirect loop. 217 * 218 * @param int $post_id The redirect post ID. 219 * @return int Filtered redirect post ID. 220 */ 221 public function disable_wp_old_slug_redirect( $post_id ) { 222 if ( is_404() && 'topic' === get_query_var( 'post_type' ) && get_query_var( 'name' ) ) { 223 $hidden_topic = get_post( $post_id ); 224 225 if ( $hidden_topic && ! current_user_can( 'read_topic', $hidden_topic->ID ) ) { 226 $post_id = 0; 227 } 228 } 229 230 return $post_id; 209 231 } 210 232
Note: See TracChangeset
for help on using the changeset viewer.