remove_permastruct()
Removes a permalink structure.
Can only be used to remove permastructs that were added using add_permastruct(). Built-in permastructs cannot be removed.
Uses: WP_Rewrite()
1 time — 0.000013 sec (very fast) | 50000 times — 0.02 sec (speed of light) | PHP 7.0.5, WP 4.5
No Hooks.
Return
null
. Nothing (null).
Usage
remove_permastruct( $name );
- $name(string) (required)
- Name for permalink structure.
Examples
#1 Removing a previously added permanent link structure for a post type
Suppose we added a structure like this add_permastruct( 'book', 'book/%book%' );
then it is deleted like this:
remove_permastruct( 'book' );
Notes
- See: WP_Rewrite::remove_permastruct()
- Global. WP_Rewrite. $wp_rewrite WordPress rewrite component.
Changelog
Since 4.5.0 | Introduced. |
remove_permastruct() remove permastruct code WP 6.6.2
function remove_permastruct( $name ) { global $wp_rewrite; $wp_rewrite->remove_permastruct( $name ); }