WordPress.org

Make WordPress Core

Changeset 11777


Ignore:
Timestamp:
08/05/09 16:43:51 (8 years ago)
Author:
ryan
Message:

rel=canonical for singular pages. see #10115

Location:
trunk/wp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/default-filters.php

    r11734 r11777  
    179179add_action('wp_head', 'wp_print_head_scripts', 9); 
    180180add_action('wp_head', 'wp_generator'); 
     181add_action('wp_head', 'rel_canonical'); 
    181182add_action('wp_footer', 'wp_print_footer_scripts'); 
    182183if(!defined('DOING_CRON')) 
  • 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.