Changeset 8057 for sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-bbp-redirect/wporg-bbp-redirect.php
- Timestamp:
- 01/09/2019 05:51:12 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-bbp-redirect/wporg-bbp-redirect.php
r3767 r8057 2 2 /** 3 3 * Plugin Name: bbPress: Redirect 4 * Description: Redirect bbPress 1 id-based slugs to new title-based slugs.4 * Description: Redirect bbPress 1 id-based slugs and >200char slugs to new title-based slugs. 5 5 * Version: 1.0 6 6 * Author: WordPress.org … … 55 55 56 56 if ( in_array( $post_type, array( 'forum', 'topic' ) ) ) { 57 $maybe_id = get_query_var( 'name' ); 57 $maybe_id = get_query_var( $post_type ); // 'name' will be truncated to 200char, topic and forum are not. 58 59 $meta_key = '_wp_old_slug'; 58 60 if ( is_numeric( $maybe_id ) ) { 61 $meta_key = sprintf( '_bbp_old_%s_id', $post_type ); 62 59 63 if ( absint( $maybe_id ) != $maybe_id ) { 60 64 return; 61 65 } 66 67 $maybe_id = absint( $maybe_id ); 62 68 } 63 $post_id = $wpdb->get_var( $wpdb->prepare( " 64 SELECT post_id 69 70 $post_id = $wpdb->get_var( $wpdb->prepare( 71 "SELECT post_id 65 72 FROM $wpdb->postmeta, $wpdb->posts 66 73 WHERE ID = post_id 67 74 AND post_type = %s 68 75 AND meta_key = %s 69 AND meta_value = % d76 AND meta_value = %s 70 77 LIMIT 1", 71 78 $post_type, 72 sprintf( '_bbp_old_%s_id', $post_type ), 73 $maybe_id ) ); 79 $meta_key, 80 $maybe_id 81 ) ); 74 82 if ( $post_id ) { 75 83 $link = get_permalink( $post_id );
Note: See TracChangeset
for help on using the changeset viewer.