add_permastruct
Add permalink structure.
Description
Parameters (3)
- 0. $name (string)
- Name for permalink structure.
- 1. $struct (string)
- Permalink structure.
- 2. $args — Optional. (array) =>
array()
- Arguments for building the rules from the permalink structure, see
WP_Rewrite
::add_permastruct(…)
for full details. Default empty array.
Usage
if ( !function_exists( 'add_permastruct' ) ) { require_once ABSPATH . WPINC . '/rewrite.php'; } // Name for permalink structure. $name = ''; // Permalink structure. $struct = ''; // Optional. Arguments for building the rules from the permalink structure, // see WP_Rewrite::add_permastruct() for full details. Default empty array. $args = array(); // NOTICE! Understand what this does before running. $result = add_permastruct($name, $struct, $args);
Defined (1)
The function is defined in the following location(s).
- /wp-includes/rewrite.php
- 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 );
- }