WordPress.org

Make WordPress Core


Ignore:
Timestamp:
10/08/2015 05:27:05 PM (5 years ago)
Author:
johnbillion
Message:

Improve the parameter names and inline documentation for add_rewrite_rule(), WP_Rewrite::add_rule(), and WP_Rewrite::add_external_rule().

Fixes #34197

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/rewrite-functions.php

    r34890 r34946  
    88
    99/**
    10  * Adds a straight rewrite rule.
     10 * Adds a rewrite rule that transforms a URL structure to a set of query vars.
     11 *
     12 * Any value in the $after parameter that isn't 'bottom' will result in the rule
     13 * being placed at the top of the rewrite rules.
    1114 *
    1215 * @since 2.1.0
    13  * @since 4.4.0 Array support was added to the `$redirect` parameter.
     16 * @since 4.4.0 Array support was added to the `$query` parameter.
    1417 *
    1518 * @global WP_Rewrite $wp_rewrite WordPress Rewrite Component.
    1619 *
    17  * @param string       $regex    Regular Expression to match request against.
    18  * @param string|array $redirect Page to redirect to, or array of query vars and values.
    19  * @param string       $after    Optional. Location where to insert the new rule. Accepts 'top',
    20  *                               or 'bottom'. Default 'bottom'.
    21  */
    22 function add_rewrite_rule( $regex, $redirect, $after = 'bottom' ) {
    23     global $wp_rewrite;
    24 
    25     $wp_rewrite->add_rule( $regex, $redirect, $after );
     20 * @param string       $regex Regular expression to match request against.
     21 * @param string|array $query The corresponding query vars for this rewrite rule.
     22 * @param string       $after Optional. Priority of the new rule. Accepts 'top'
     23 *                            or 'bottom'. Default 'bottom'.
     24 */
     25function add_rewrite_rule( $regex, $query, $after = 'bottom' ) {
     26    global $wp_rewrite;
     27
     28    $wp_rewrite->add_rule( $regex, $query, $after );
    2629}
    2730
Note: See TracChangeset for help on using the changeset viewer.