WordPress.org

Make WordPress Core

Ticket #23091: 23091.2.diff

File 23091.2.diff, 1009 bytes (added by SergeyBiryukov, 5 years ago)
  • wp-admin/includes/post.php

     
    742742        if ( !strpos($content, '?attachment_id=') || !preg_match_all( '/<a ([^>]+)>[\s\S]+?<\/a>/', $content, $link_matches ) )
    743743                return;
    744744
    745         $site_url = get_bloginfo('url');
    746         $site_url = substr( $site_url, (int) strpos($site_url, '://') ); // remove the http(s)
     745        $home_url = home_url();
     746        $home_url = substr( $home_url, (int) strpos( $home_url, '://' ) ); // remove the http(s)
    747747        $replace = '';
    748748
    749749        foreach ( $link_matches[1] as $key => $value ) {
     
    756756                $url_id = (int) $url_match[2];
    757757                $rel_id = (int) $rel_match[1];
    758758
    759                 if ( !$url_id || !$rel_id || $url_id != $rel_id || strpos($url_match[0], $site_url) === false )
     759                if ( !$url_id || !$rel_id || $url_id != $rel_id || strpos( $url_match[0], $home_url ) === false )
    760760                        continue;
    761761
    762762                $link = $link_matches[0][$key];