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.
Parameters Parameters
- $val
-
(string[]) (Required) Array of post types to query.
Return Return
(string[]) Cleaned array.
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 ); }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
6.0.0 | Introduced. |