WordPress.org

Make WordPress Core

Ticket #4209: 4209.2.diff

File 4209.2.diff, 887 bytes (added by vladimir_kolesnikov, 9 years ago)

Patch 2 (we check if rel is already there)

  • wp-includes/link-template.php

     
    12071207
    12081208        $title = apply_filters('the_title', $title, $post);
    12091209        $date = mysql2date(get_option('date_format'), $post->post_date);
     1210        $rel = $previous ? 'prev' : 'next';
    12101211
    12111212        $string = '<a href="'.get_permalink($post).'">';
    12121213        $link = str_replace('%title', $title, $link);
     
    12161217        $format = str_replace('%link', $link, $format);
    12171218
    12181219        $adjacent = $previous ? 'previous' : 'next';
    1219         echo apply_filters( "{$adjacent}_post_link", $format, $link );
     1220        $result = apply_filters( "{$adjacent}_post_link", $format, $link );
     1221        if ( !preg_match('/\\brel=/', $result) ) {
     1222                $result = str_replace('<a ', '<a rel="'.$rel.'" ', $result);
     1223        }
     1224
     1225        echo $result;
    12201226}
    12211227
    12221228/**