WP_Taxonomy::remove_rewrite_rules() WordPress Method

The WP_Taxonomy::remove_rewrite_rules() method is used to remove any rewrite rules that were generated for a custom taxonomy. This is typically called when the taxonomy is being unregistered.

WP_Taxonomy::remove_rewrite_rules() #

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


Source

File: wp-includes/class-wp-taxonomy.php

	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 );
		}
	}


Top ↑

Changelog

Changelog
VersionDescription
4.7.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.