mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 14:20:15 +00:00
Shortlinks: Use the home URL for a page on front.
This will result in 'Get Shortlink' hiding by default, as it will match the permalink (also the home URL). fixes #26871. git-svn-id: https://develop.svn.wordpress.org/trunk@27802 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -2788,8 +2788,12 @@ function wp_get_shortlink($id = 0, $context = 'post', $allow_slugs = true) {
|
||||
// Return p= link for all public post types.
|
||||
if ( ! empty( $post_id ) ) {
|
||||
$post_type = get_post_type_object( $post->post_type );
|
||||
if ( $post_type->public )
|
||||
$shortlink = home_url('?p=' . $post_id);
|
||||
|
||||
if ( 'page' === $post->post_type && $post->ID == get_option( 'page_on_front' ) && 'page' == get_option( 'show_on_front' ) ) {
|
||||
$shortlink = home_url( '/' );
|
||||
} elseif ( $post_type->public ) {
|
||||
$shortlink = home_url( '?p=' . $post_id );
|
||||
}
|
||||
}
|
||||
|
||||
return apply_filters('get_shortlink', $shortlink, $id, $context, $allow_slugs);
|
||||
|
||||
Reference in New Issue
Block a user