diff --git a/wp-includes/link-template.php b/wp-includes/link-template.php index 3ba099bdc1..51011741a6 100644 --- a/wp-includes/link-template.php +++ b/wp-includes/link-template.php @@ -154,7 +154,7 @@ function get_permalink($id = 0, $leavename = false) { $permalink = user_trailingslashit($permalink, 'single'); return apply_filters('post_link', $permalink, $post, $leavename); } else { // if they're not using the fancy permalink option - $permalink = get_option('home') . '/?p=' . $post->ID; + $permalink = user_trailingslashit(get_option('home')) . '?p=' . $post->ID; return apply_filters('post_link', $permalink, $post, $leavename); } } @@ -225,10 +225,10 @@ function _get_page_link( $id = false, $leavename = false, $sample = false ) { if ( '' != $pagestruct && ( ( isset($post->post_status) && 'draft' != $post->post_status ) || $sample ) ) { $link = get_page_uri($id); $link = ( $leavename ) ? $pagestruct : str_replace('%pagename%', $link, $pagestruct); - $link = get_option('home') . "/$link"; + $link = user_trailingslashit(get_option('home')) . "$link"; $link = user_trailingslashit($link, 'page'); } else { - $link = get_option('home') . "/?page_id=$id"; + $link = user_trailingslashit(get_option('home')) . "?page_id=$id"; } return apply_filters( '_get_page_link', $link, $id ); @@ -269,7 +269,7 @@ function get_attachment_link($id = false) { } if (! $link ) { - $link = get_bloginfo('url') . "/?attachment_id=$id"; + $link = user_trailingslashit(get_bloginfo('url')) . "?attachment_id=$id"; } return apply_filters('attachment_link', $link, $id); @@ -292,7 +292,7 @@ function get_year_link($year) { $yearlink = str_replace('%year%', $year, $yearlink); return apply_filters('year_link', get_option('home') . user_trailingslashit($yearlink, 'year'), $year); } else { - return apply_filters('year_link', get_option('home') . '/?m=' . $year, $year); + return apply_filters('year_link', user_trailingslashit(get_option('home')) . '?m=' . $year, $year); } } @@ -317,7 +317,7 @@ function get_month_link($year, $month) { $monthlink = str_replace('%monthnum%', zeroise(intval($month), 2), $monthlink); return apply_filters('month_link', get_option('home') . user_trailingslashit($monthlink, 'month'), $year, $month); } else { - return apply_filters('month_link', get_option('home') . '/?m=' . $year . zeroise($month, 2), $year, $month); + return apply_filters('month_link', user_trailingslashit(get_option('home')) . '?m=' . $year . zeroise($month, 2), $year, $month); } } @@ -347,7 +347,7 @@ function get_day_link($year, $month, $day) { $daylink = str_replace('%day%', zeroise(intval($day), 2), $daylink); return apply_filters('day_link', get_option('home') . user_trailingslashit($daylink, 'day'), $year, $month, $day); } else { - return apply_filters('day_link', get_option('home') . '/?m=' . $year . zeroise($month, 2) . zeroise($day, 2), $year, $month, $day); + return apply_filters('day_link', user_trailingslashit(get_option('home')) . '?m=' . $year . zeroise($month, 2) . zeroise($day, 2), $year, $month, $day); } } @@ -382,7 +382,7 @@ function get_feed_link($feed = '') { if ( false !== strpos($feed, 'comments_') ) $feed = str_replace('comments_', 'comments-', $feed); - $output = get_option('home') . "/?feed={$feed}"; + $output = user_trailingslashit(get_option('home')) . "?feed={$feed}"; } return apply_filters('feed_link', $output, $feed); @@ -414,9 +414,9 @@ function get_post_comments_feed_link($post_id = '', $feed = '') { } else { $type = get_post_field('post_type', $post_id); if ( 'page' == $type ) - $url = get_option('home') . "/?feed=$feed&page_id=$post_id"; + $url = user_trailingslashit(get_option('home')) . "?feed=$feed&page_id=$post_id"; else - $url = get_option('home') . "/?feed=$feed&p=$post_id"; + $url = user_trailingslashit(get_option('home')) . "?feed=$feed&p=$post_id"; } return apply_filters('post_comments_feed_link', $url); @@ -468,7 +468,7 @@ function get_author_feed_link( $author_id, $feed = '' ) { $feed = get_default_feed(); if ( '' == $permalink_structure ) { - $link = get_option('home') . "?feed=$feed&author=" . $author_id; + $link = user_trailingslashit(get_option('home')) . "?feed=$feed&author=" . $author_id; } else { $link = get_author_posts_url($author_id); if ( $feed == get_default_feed() ) @@ -512,7 +512,7 @@ function get_category_feed_link($cat_id, $feed = '') { $permalink_structure = get_option('permalink_structure'); if ( '' == $permalink_structure ) { - $link = trailingslashit( get_option('home') ) . "?feed=$feed&cat=" . $cat_id; + $link = user_trailingslashit(get_option('home')) . "?feed=$feed&cat=" . $cat_id; } else { $link = get_category_link($cat_id); if( $feed == get_default_feed() ) @@ -551,7 +551,7 @@ function get_tag_feed_link($tag_id, $feed = '') { $feed = get_default_feed(); if ( '' == $permalink_structure ) { - $link = get_option('home') . "?feed=$feed&tag=" . $tag->slug; + $link = user_trailingslashit(get_option('home')) . "?feed=$feed&tag=" . $tag->slug; } else { $link = get_tag_link($tag->term_id); if ( $feed == get_default_feed() ) @@ -626,7 +626,7 @@ function get_search_feed_link($search_query = '', $feed = '') { if ( empty($feed) ) $feed = get_default_feed(); - $link = get_option('home') . "?s=$search&feed=$feed"; + $link = user_trailingslashit(get_option('home')) . "?s=$search&feed=$feed"; $link = apply_filters('search_feed_link', $link); @@ -651,7 +651,7 @@ function get_search_comments_feed_link($search_query = '', $feed = '') { if ( empty($feed) ) $feed = get_default_feed(); - $link = get_option('home') . "?s=$search&feed=comments-$feed"; + $link = user_trailingslashit(get_option('home')) . "?s=$search&feed=comments-$feed"; $link = apply_filters('search_feed_link', $link);