add_permastruct()

最后更新于:2021-11-25 19:23:59

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

Add permalink structure.

参数

$name

(string) (Required) Name for permalink structure.

$struct

(string) (Required) Permalink structure.

$args

(array) (Optional) Arguments for building the rules from the permalink structure, see GC_Rewrite::add_permastruct() for full details.

Default value: array()

源文件

文件: gc-includes/rewrite.php

function add_permastruct( $name, $struct, $args = array() ) {
	global $gc_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 );
	}

	$gc_rewrite->add_permastruct( $name, $struct, $args );
}