WP_Post::filter() WordPress Method

The WP_Post::filter() method is used to filter post data before it is updated in the database. This is useful for ensuring that data is sanitized before it is stored in the database.

WP_Post::filter( string $filter ) #

{@Missing Summary}


Parameters

$filter

(string)(Required)Filter.


Top ↑

Return

(WP_Post)


Top ↑

Source

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

	public function filter( $filter ) {
		if ( $this->filter === $filter ) {
			return $this;
		}

		if ( 'raw' === $filter ) {
			return self::get_instance( $this->ID );
		}

		return sanitize_post( $this, $filter );
	}


Top ↑

Changelog

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