On this page
add_permastruct( string $name, string $struct, array $args = array() )
Adds a permalink structure.
Description
See also
Parameters
$namestring Required-
Name for permalink structure.
$structstring Required-
Permalink structure.
$argsarray Optional-
Arguments for building the rules from the permalink structure, see WP_Rewrite::add_permastruct() for full details.
More Arguments from WP_Rewrite::add_permastruct( ... $args )
Arguments for building rewrite rules based on the permalink structure.
with_frontboolWhether the structure should be prepended withWP_Rewrite::$front.
Default true.ep_maskintThe endpoint mask defining which endpoints are added to the structure.
Accepts a mask of:
EP_ALLEP_NONEEP_ALL_ARCHIVESEP_ATTACHMENTEP_AUTHORSEP_CATEGORIESEP_COMMENTSEP_DATEEP_DAYEP_MONTHEP_PAGESEP_PERMALINKEP_ROOTEP_SEARCHEP_TAGSEP_YEARDefaultEP_NONE.
pagedboolWhether archive pagination rules should be added for the structure.
Default true.feedboolWhether feed rewrite rules should be added for the structure. Default true.forcommentsboolWhether the feed rules should be a query for a comments feed. Default false.walk_dirsboolWhether the'directories'making up the structure should be walked over and rewrite rules built for each in-turn. Default true.endpointsboolWhether endpoints should be applied to the generated rules. Default true.
Default:
array()
Source
File: wp-includes/rewrite.php. View all references
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 );
}
Related
Uses
| Uses | Description |
|---|---|
| WP_Rewrite::add_permastruct() wp-includes/class-wp-rewrite.php | Adds a new permalink structure. |
Used By
| Used By | Description |
|---|---|
| WP_Taxonomy::add_rewrite_rules() wp-includes/class-wp-taxonomy.php | Adds the necessary rewrite rules for the taxonomy. |
| WP_Post_Type::add_rewrite_rules() wp-includes/class-wp-post-type.php | Adds the necessary rewrite rules for the post type. |
Changelog
| Version | Description |
|---|---|
| 3.0.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/add_permastruct