WP_Rewrite::get_extra_permastruct() WordPress Method

The WP_Rewrite::get_extra_permastruct() method is used to get the extra permastruct for a specific permalink. This method is useful for custom post types and taxonomies, which may have their own permastructs. By default, this method will return an empty string.

WP_Rewrite::get_extra_permastruct( string $name ) #

Retrieves an extra permalink structure by name.


Parameters

$name

(string)(Required)Permalink structure name.


Top ↑

Return

(string|false) Permalink structure string on success, false on failure.


Top ↑

Source

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

	public function get_extra_permastruct( $name ) {
		if ( empty( $this->permalink_structure ) ) {
			return false;
		}

		if ( isset( $this->extra_permastructs[ $name ] ) ) {
			return $this->extra_permastructs[ $name ]['struct'];
		}

		return false;
	}


Top ↑

Changelog

Changelog
VersionDescription
2.5.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.