remove_permastruct()WP 4.5.0

Removes a previously added permalink structure (permalinks).

Can only be used for structures added via add_permastruct(). Built-in permalink structures (for post types with the built-in parameter) cannot be removed.

Works based on the method WP_Rewrite::remove_permastruct():

    /**
	 * Removes a permalink structure.
	 *
	 * @since 4.5.0
	 * @access public
	 *
	 * @param string $name Name for permalink structure.
	 */
	public function remove_permastruct( $name ) {
		unset( $this->extra_permastructs[ $name ] );
	}
1 time — 0.000013 sec (very fast) | 50000 times — 0.02 sec (speed of light) | PHP 7.0.5, WP 4.5

No Hooks.

Returns

null. Nothing.

Usage

remove_permastruct( $name );
$name(string) (required)
Name of the permalink structure.

Examples

0

#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

Changelog

Since 4.5.0 Introduced.

remove_permastruct() code WP 7.0

function remove_permastruct( $name ) {
	global $wp_rewrite;

	$wp_rewrite->remove_permastruct( $name );
}