WordPress.org

Make WordPress Core

Changeset 13438


Ignore:
Timestamp:
02/26/2010 07:23:58 PM (8 years ago)
Author:
nacin
Message:

Introduce add_permastruct() and flush_rewrite_rules(), wrappers for the corresponding WP_Rewrite methods. Fixes #10912 props scribu

File:
1 edited

Legend:

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

    r13377 r13438  
    4444    $wp->add_query_var($qv);
    4545    $wp_rewrite->add_rewrite_tag($tagname, $regex, $qv . '=');
     46}
     47
     48/**
     49 * Add permalink structure.
     50 *
     51 * @see WP_Rewrite::add_permastruct()
     52 * @since 3.0.0
     53 *
     54 * @param string $name Name for permalink structure.
     55 * @param string $struct Permalink structure.
     56 * @param bool $with_front Prepend front base to permalink structure.
     57 */
     58function add_permastruct( $name, $struct, $with_front = true ) {
     59    global $wp_rewrite;
     60    return $wp_rewrite->add_permastruct( $name, $struct, $with_front );
    4661}
    4762
     
    6580    add_action($hook, $function, 10, 1);
    6681    return $hook;
     82}
     83
     84/**
     85 * Remove rewrite rules and then recreate rewrite rules.
     86 *
     87 * @see WP_Rewrite::flush_rules()
     88 * @since 3.0.0
     89 *
     90 * @param bool $hard Whether to update .htaccess (hard flush) or just update
     91 *  rewrite_rules transient (soft flush). Default is true (hard).
     92 */
     93function flush_rewrite_rules( $hard = true ) {
     94    global $wp_rewrite;
     95    $wp_rewrite->flush_rules( $hard );
    6796}
    6897
Note: See TracChangeset for help on using the changeset viewer.