WordPress.org

Make WordPress Core

Changeset 6494


Ignore:
Timestamp:
12/25/07 20:48:47 (7 years ago)
Author:
ryan
Message:

phpdoc for canonical.php from darkdragon. fixes #5526

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/canonical.php

    r6436 r6494  
    11<?php 
    2 // Based on "Permalink Redirect" from Scott Yang and "Enforce www. Preference" by Mark Jaquith 
    3  
    4 function redirect_canonical($requested_url=NULL, $do_redirect=true) { 
     2/** 
     3 * Canonical API to handle WordPress Redirecting 
     4 * 
     5 * Based on "Permalink Redirect" from Scott Yang and "Enforce www. Preference" by Mark Jaquith 
     6 * 
     7 * @author Scott Yang 
     8 * @author Mark Jaquith 
     9 * @package WordPress 
     10 * @since 2.3 
     11 */ 
     12 
     13/** 
     14 * redirect_canonical() - Redirects incoming links to the proper URL based on the site url 
     15 * 
     16 * Search engines consider www.somedomain.com and somedomain.com to be two different URLs 
     17 * when they both go to the same location. This SEO enhancement prevents penality for 
     18 * duplicate content by redirecting all incoming links to one or the other. 
     19 * 
     20 * Prevents redirection for feeds, trackbacks, searches, comment popup, and admin URLs. 
     21 * Does not redirect on IIS, page/post previews, and on form data. 
     22 * 
     23 * Will also attempt to find the correct link when a user enters a URL that does not exist 
     24 * based on exact WordPress query. Will instead try to parse the URL or query in an attempt 
     25 * to figure the correct page to go to. 
     26 * 
     27 * @since 2.3 
     28 * @uses $wp_rewrite 
     29 * @uses $is_IIS 
     30 * 
     31 * @param string $requested_url Optional. The URL that was requested, used to figure if redirect is needed. 
     32 * @param bool $do_redirect Optional. Redirect to the new URL. 
     33 * @return null|false|string Null, if redirect not needed. False, if redirect not needed or the string of the URL 
     34 */ 
     35function redirect_canonical($requested_url=null, $do_redirect=true) { 
    536    global $wp_rewrite, $is_IIS; 
    637 
     
    176207} 
    177208 
     209/** 
     210 * redirect_guess_404_permalink() - Tries to guess correct post based on query vars 
     211 * 
     212 * @since 2.3 
     213 * @uses $wpdb 
     214 * 
     215 * @return bool|string Returns False, if it can't find post, returns correct location on success. 
     216 */ 
    178217function redirect_guess_404_permalink() { 
    179218    global $wpdb; 
Note: See TracChangeset for help on using the changeset viewer.