WP_Importer::min_whitespace() WordPress Method

The WP_Importer::min_whitespace() method is used to remove any extra whitespace from a string. This is useful when cleaning up imported content, as it can help to remove any invalid characters that may have been introduced during the import process.

WP_Importer::min_whitespace( string $text ) #

Replace newlines, tabs, and multiple spaces with a single space.


Parameters

$text

(string)(Required)


Top ↑

Return

(string)


Top ↑

Source

File: wp-admin/includes/class-wp-importer.php

	public function min_whitespace( $text ) {
		return preg_replace( '|[\r\n\t ]+|', ' ', $text );
	}

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.