add_permastruct

Add permalink structure.

Description

add_permastruct( (string) $name, (string) $struct, (array) $args = array() ); 

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

  1. if ( !function_exists( 'add_permastruct' ) ) { 
  2. require_once ABSPATH . WPINC . '/rewrite.php'; 
  3.  
  4. // Name for permalink structure. 
  5. $name = ''; 
  6.  
  7. // Permalink structure. 
  8. $struct = ''; 
  9.  
  10. // Optional. Arguments for building the rules from the permalink structure, 
  11. // see WP_Rewrite::add_permastruct() for full details. Default empty array. 
  12. $args = array(); 
  13.  
  14. // NOTICE! Understand what this does before running. 
  15. $result = add_permastruct($name, $struct, $args); 
  16.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/rewrite.php  
  1. function add_permastruct( $name, $struct, $args = array() ) { 
  2. global $wp_rewrite; 
  3.  
  4. // Back-compat for the old parameters: $with_front and $ep_mask. 
  5. if ( ! is_array( $args ) ) 
  6. $args = array( 'with_front' => $args ); 
  7. if ( func_num_args() == 4 ) 
  8. $args['ep_mask'] = func_get_arg( 3 ); 
  9.  
  10. $wp_rewrite->add_permastruct( $name, $struct, $args );