remove_rewrite_tag()WP 4.5.0

Removes an existing rewrite tag (like %postname%).

1 time — 0.00002 sec (very fast) | 50000 times — 0.07 sec (speed of light) | PHP 7.0.5, WP 4.5

No Hooks.

Return

null. Nothing.

Usage

remove_rewrite_tag( $tag );
$tag(string) (required)
Name of the rewrite tag.

Examples

0

#1 Delete the rewrite tag [auto-translate]

Suppose we added a query tag '%mytag%' and at some point we need to remove it:

remove_rewrite_tag( '%mytag%' );

Notes

  • Global. WP_Rewrite. $wp_rewrite WordPress rewrite component.

Changelog

Since 4.5.0 Introduced.

remove_rewrite_tag() code WP 6.1.1

function remove_rewrite_tag( $tag ) {
	global $wp_rewrite;
	$wp_rewrite->remove_rewrite_tag( $tag );
}