Ticket #14760: wp_get_shortlink.diff
| File wp_get_shortlink.diff, 1.3 KB (added by , 15 years ago) |
|---|
-
wp-includes/link-template.php
2358 2358 * Return a shortlink for a post, page, attachment, or blog. 2359 2359 * 2360 2360 * This function exists to provide a shortlink tag that all themes and plugins can target. A plugin must hook in to 2361 * provide the actual shortlinks. Default shortlink support is limited to providing ?p= style links for posts.2361 * provide the actual shortlinks. Default shortlink support is limited to providing ?p= style links. 2362 2362 * Plugins can short circuit this function via the pre_get_shortlink filter or filter the output 2363 2363 * via the get_shortlink filter. 2364 2364 * … … 2377 2377 2378 2378 global $wp_query; 2379 2379 $post_id = 0; 2380 if ( 'query' == $context && is_single() ) {2380 if ( 'query' == $context && (is_single() || is_page()) ) { 2381 2381 $post_id = $wp_query->get_queried_object_id(); 2382 2382 } elseif ( 'post' == $context ) { 2383 2383 $post = get_post($id); … … 2389 2389 // Return p= link for posts. 2390 2390 if ( !empty($post_id) && '' != get_option('permalink_structure') ) { 2391 2391 $post = get_post($post_id); 2392 if ( isset($post->post_type) && 'post' == $post->post_type)2392 if ( isset($post->post_type) ) 2393 2393 $shortlink = home_url('?p=' . $post->ID); 2394 2394 } 2395 2395