WP_Taxonomy::remove_rewrite_rules()publicWP 4.7.0

Removes any rewrite rules, permastructs, and rules for the taxonomy.

Method of the class: WP_Taxonomy{}

No Hooks.

Return

null. Nothing.

Usage

$WP_Taxonomy = new WP_Taxonomy();
$WP_Taxonomy->remove_rewrite_rules();

Notes

  • Global. WP. $wp Current WordPress environment instance.

Changelog

Since 4.7.0 Introduced.

WP_Taxonomy::remove_rewrite_rules() code WP 6.1.1

public function remove_rewrite_rules() {
	/* @var WP $wp */
	global $wp;

	// Remove query var.
	if ( false !== $this->query_var ) {
		$wp->remove_query_var( $this->query_var );
	}

	// Remove rewrite tags and permastructs.
	if ( false !== $this->rewrite ) {
		remove_rewrite_tag( "%$this->name%" );
		remove_permastruct( $this->name );
	}
}