Make WordPress Core


Ignore:
Timestamp:
08/05/2009 04:43:51 PM (16 years ago)
Author:
ryan
Message:

rel=canonical for singular pages. see #10115

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/link-template.php

    r11752 r11777  
    18071807}
    18081808
     1809/**
     1810 * Output rel=canonical for singular queries
     1811 *
     1812 * @package WordPress
     1813 * @since 2.9.0
     1814*/
     1815function rel_canonical() {
     1816    if ( !is_singular() )
     1817        return;
     1818
     1819    global $wp_the_query;
     1820    if ( !$id = $wp_the_query->get_queried_object_id() )
     1821        return;
     1822
     1823    $link = get_permalink( $id );
     1824    echo "<link rel='canonical' href='$link' />\n";
     1825}
     1826
    18091827?>
Note: See TracChangeset for help on using the changeset viewer.