add_permastruct

The timeline below displays how wordpress function add_permastruct has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.3

/**
 * Adds a permalink structure.
 *
 * @since 3.0.0
 *
 * @see WP_Rewrite::add_permastruct()
 * @global WP_Rewrite $wp_rewrite WordPress rewrite component.
 *
 * @param string $name   Name for permalink structure.
 * @param string $struct Permalink structure.
 * @param array  $args   Optional. Arguments for building the rules from the permalink structure,
 *                       see WP_Rewrite::add_permastruct() for full details. Default empty array.
 */
function add_permastruct($name, $struct, $args = array())
{
    global $wp_rewrite;
    // Back-compat for the old parameters: $with_front and $ep_mask.
    if (!is_array($args)) {
        $args = array('with_front' => $args);
    }
    if (func_num_args() === 4) {
        $args['ep_mask'] = func_get_arg(3);
    }
    $wp_rewrite->add_permastruct($name, $struct, $args);
}

WordPress Version: 6.1

/**
 * Adds a permalink structure.
 *
 * @since 3.0.0
 *
 * @see WP_Rewrite::add_permastruct()
 * @global WP_Rewrite $wp_rewrite WordPress rewrite component.
 *
 * @param string $name   Name for permalink structure.
 * @param string $struct Permalink structure.
 * @param array  $args   Optional. Arguments for building the rules from the permalink structure,
 *                       see WP_Rewrite::add_permastruct() for full details. Default empty array.
 */
function add_permastruct($name, $struct, $args = array())
{
    global $wp_rewrite;
    // Back-compat for the old parameters: $with_front and $ep_mask.
    if (!is_array($args)) {
        $args = array('with_front' => $args);
    }
    if (func_num_args() == 4) {
        $args['ep_mask'] = func_get_arg(3);
    }
    $wp_rewrite->add_permastruct($name, $struct, $args);
}

WordPress Version: 4.6

/**
 * Add permalink structure.
 *
 * @since 3.0.0
 *
 * @see WP_Rewrite::add_permastruct()
 * @global WP_Rewrite $wp_rewrite WordPress rewrite component.
 *
 * @param string $name   Name for permalink structure.
 * @param string $struct Permalink structure.
 * @param array  $args   Optional. Arguments for building the rules from the permalink structure,
 *                       see WP_Rewrite::add_permastruct() for full details. Default empty array.
 */
function add_permastruct($name, $struct, $args = array())
{
    global $wp_rewrite;
    // Back-compat for the old parameters: $with_front and $ep_mask.
    if (!is_array($args)) {
        $args = array('with_front' => $args);
    }
    if (func_num_args() == 4) {
        $args['ep_mask'] = func_get_arg(3);
    }
    $wp_rewrite->add_permastruct($name, $struct, $args);
}

WordPress Version: 4.5

/**
 * Add permalink structure.
 *
 * @since 3.0.0
 *
 * @see WP_Rewrite::add_permastruct()
 * @global WP_Rewrite $wp_rewrite WordPress rewrite component.
 *
 * @param string $name   Name for permalink structure.
 * @param string $struct Permalink structure.
 * @param array  $args   Optional. Arguments for building the rules from the permalink structure,
 *                       see WP_Rewrite::add_permastruct() for full details. Default empty array.
 */
function add_permastruct($name, $struct, $args = array())
{
    global $wp_rewrite;
    // backwards compatibility for the old parameters: $with_front and $ep_mask
    if (!is_array($args)) {
        $args = array('with_front' => $args);
    }
    if (func_num_args() == 4) {
        $args['ep_mask'] = func_get_arg(3);
    }
    $wp_rewrite->add_permastruct($name, $struct, $args);
}

WordPress Version: 4.4

/**
 * Add permalink structure.
 *
 * @since 3.0.0
 *
 * @see WP_Rewrite::add_permastruct()
 * @global WP_Rewrite $wp_rewrite
 *
 * @param string $name   Name for permalink structure.
 * @param string $struct Permalink structure.
 * @param array  $args   Optional. Arguments for building the rules from the permalink structure,
 *                       see WP_Rewrite::add_permastruct() for full details. Default empty array.
 */
function add_permastruct($name, $struct, $args = array())
{
    global $wp_rewrite;
    // backwards compatibility for the old parameters: $with_front and $ep_mask
    if (!is_array($args)) {
        $args = array('with_front' => $args);
    }
    if (func_num_args() == 4) {
        $args['ep_mask'] = func_get_arg(3);
    }
    $wp_rewrite->add_permastruct($name, $struct, $args);
}

WordPress Version: 4.3

/**
 * Add permalink structure.
 *
 * @since 3.0.0
 *
 * @global WP_Rewrite $wp_rewrite
 *
 * @param string $name   Name for permalink structure.
 * @param string $struct Permalink structure.
 * @param array  $args   Optional configuration for building the rules from the permalink structure,
 *                       see {@link WP_Rewrite::add_permastruct()} for full details.
 */
function add_permastruct($name, $struct, $args = array())
{
    global $wp_rewrite;
    // backwards compatibility for the old parameters: $with_front and $ep_mask
    if (!is_array($args)) {
        $args = array('with_front' => $args);
    }
    if (func_num_args() == 4) {
        $args['ep_mask'] = func_get_arg(3);
    }
    $wp_rewrite->add_permastruct($name, $struct, $args);
}

WordPress Version: 3.7

/**
 * Add permalink structure.
 *
 * @see WP_Rewrite::add_permastruct()
 * @since 3.0.0
 *
 * @param string $name Name for permalink structure.
 * @param string $struct Permalink structure.
 * @param array $args Optional configuration for building the rules from the permalink structure,
 *     see {@link WP_Rewrite::add_permastruct()} for full details.
 */
function add_permastruct($name, $struct, $args = array())
{
    global $wp_rewrite;
    // backwards compatibility for the old parameters: $with_front and $ep_mask
    if (!is_array($args)) {
        $args = array('with_front' => $args);
    }
    if (func_num_args() == 4) {
        $args['ep_mask'] = func_get_arg(3);
    }
    return $wp_rewrite->add_permastruct($name, $struct, $args);
}