Ticket #13125: 13125.patch
| File 13125.patch, 1.0 KB (added by , 16 years ago) |
|---|
-
canonical.php
82 82 // These tests give us a WP-generated permalink 83 83 if ( is_404() ) { 84 84 $redirect_url = redirect_guess_404_permalink(); 85 86 // #13125: redirect p=NNN links to page_id=NNN (if page exists) instead of 404ing 87 if( $id = get_query_var('p') ) { 88 $type = $wpdb->get_var( $wpdb->prepare("SELECT post_type FROM $wpdb->posts WHERE ID = %d", $id ) ); 89 if($type && 'page' == $type) { 90 $redirect['query'] = remove_query_arg(array('p', 'page_id'), $redirect['query']); 91 $redirect_url = get_permalink($id); 92 } 93 } 85 94 } elseif ( is_object($wp_rewrite) && $wp_rewrite->using_permalinks() ) { 86 95 // rewriting of old ?p=X, ?m=2004, ?m=200401, ?m=20040101 87 96 if ( is_attachment() && !empty($_GET['attachment_id']) && ! $redirect_url ) { … … 387 396 388 397 add_action('template_redirect', 'redirect_canonical'); 389 398 390 ?> 399 ?> 400 No newline at end of file