Warning: Array to string conversion in /mnt/data/home/502433.cloudwaysapps.com/rhbymdevka/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 808

Warning: foreach() argument must be of type array|object, string given in /mnt/data/home/502433.cloudwaysapps.com/rhbymdevka/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 813

Warning: Array to string conversion in /mnt/data/home/502433.cloudwaysapps.com/rhbymdevka/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 808
PUM_ConditionCallbacks::post_type_tax( array $condition = array() )

Checks if the post_type has the selected categories.


Description Description


Warning: Array to string conversion in /mnt/data/home/502433.cloudwaysapps.com/rhbymdevka/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 808

Warning: foreach() argument must be of type array|object, string given in /mnt/data/home/502433.cloudwaysapps.com/rhbymdevka/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 813

Warning: Array to string conversion in /mnt/data/home/502433.cloudwaysapps.com/rhbymdevka/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 808

Parameters Parameters

$condition

(Optional)

Default value: array()


Top ↑

Return Return

(bool)


Top ↑

Source Source

File: classes/ConditionCallbacks.php

	public static function post_type_tax( $condition = array() ) {

		$target = explode( '_w_', $condition['target'] );

		// First key is the post type.
		$post_type = array_shift( $target );

		// Last Key is the taxonomy
		$taxonomy = array_pop( $target );

		if ( $taxonomy == 'category' ) {
			return self::post_type_category( $condition );
		} elseif ( $taxonomy == 'post_tag' ) {
			return self::post_type_tag( $condition );
		}

		$selected = ! empty( $condition['settings']['selected'] ) ? $condition['settings']['selected'] : array();
		if ( self::is_post_type( $post_type ) && has_term( wp_parse_id_list( $selected ), $taxonomy ) ) {
			return true;
		}

		return false;
	}


Top ↑

User Contributed Notes User Contributed Notes

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