WP_Rewrite::using_index_permalinks() WordPress Method

The WP_Rewrite::using_index_permalinks() function allows you to check if permalinks are using the index.php file. This is useful for checking if a WordPress installation is using the correct permalink structure.

WP_Rewrite::using_index_permalinks() #

Determines whether permalinks are being used and rewrite module is not enabled.


Description

Means that permalink links are enabled and index.php is in the URL.


Top ↑

Return

(bool) Whether permalink links are enabled and index.php is in the URL.


Top ↑

More Information

Returns true if your blog is using PATHINFO permalinks.


Top ↑

Source

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

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

		// If the index is not in the permalink, we're using mod_rewrite.
		return preg_match( '#^/*' . $this->index . '#', $this->permalink_structure );
	}


Top ↑

Changelog

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