LLMS_Abstract_Posts_Query::sanitize_post_types( string[] $val )

Sanitize the post_types query argument.


Description Description

Any post types not explicitly included in the $allowed_post_types list are removed from the input.


Top ↑

Parameters Parameters

$val

(string[]) (Required) Array of post types to query.


Top ↑

Return Return

(string[]) Cleaned array.


Top ↑

Source Source

File: includes/abstracts/llms-abstract-posts-query.php

	protected function sanitize_post_types( $val ) {

		if ( ! is_array( $val ) ) {
			return array();
		}

		foreach ( $val as $index => $post_type ) {
			if ( ! in_array( $post_type, $this->allowed_post_types, true ) ) {
				unset( $val[ $index ] );
			}
		}

		return array_values( $val );

	}


Top ↑

Changelog Changelog

Changelog
Version Description
6.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.