WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

WC_Shortcode_Products::parse_query_args() WC 3.2.0

Parse query args.

Это метод класса: WC_Shortcode_Products

Хуки из метода
Возвращает

Массив.

Использование

$WC_Shortcode_Products = new WC_Shortcode_Products();
$var = $WC_Shortcode_Products->parse_query_args();

Код WC Shortcode Products::parse query args: woocommerce/includes/shortcodes/class-wc-shortcode-products.php WC 3.6.3

<?php
protected function parse_query_args() {
	$query_args = array(
		'post_type'           => 'product',
		'post_status'         => 'publish',
		'ignore_sticky_posts' => true,
		'no_found_rows'       => false === wc_string_to_bool( $this->attributes['paginate'] ),
		'orderby'             => empty( $_GET['orderby'] ) ? $this->attributes['orderby'] : wc_clean( wp_unslash( $_GET['orderby'] ) ),
	);

	$orderby_value         = explode( '-', $query_args['orderby'] );
	$orderby               = esc_attr( $orderby_value[0] );
	$order                 = ! empty( $orderby_value[1] ) ? $orderby_value[1] : strtoupper( $this->attributes['order'] );
	$query_args['orderby'] = $orderby;
	$query_args['order']   = $order;

	if ( wc_string_to_bool( $this->attributes['paginate'] ) ) {
		$this->attributes['page'] = absint( empty( $_GET['product-page'] ) ? 1 : $_GET['product-page'] ); // WPCS: input var ok, CSRF ok.
	}

	if ( ! empty( $this->attributes['rows'] ) ) {
		$this->attributes['limit'] = $this->attributes['columns'] * $this->attributes['rows'];
	}

	// @codingStandardsIgnoreStart
	$ordering_args                = WC()->query->get_catalog_ordering_args( $query_args['orderby'], $query_args['order'] );
	$query_args['orderby']        = $ordering_args['orderby'];
	$query_args['order']          = $ordering_args['order'];
	if ( $ordering_args['meta_key'] ) {
		$query_args['meta_key']       = $ordering_args['meta_key'];
	}
	$query_args['posts_per_page'] = intval( $this->attributes['limit'] );
	if ( 1 < $this->attributes['page'] ) {
		$query_args['paged']          = absint( $this->attributes['page'] );
	}
	$query_args['meta_query']     = WC()->query->get_meta_query();
	$query_args['tax_query']      = array();
	// @codingStandardsIgnoreEnd

	// Visibility.
	$this->set_visibility_query_args( $query_args );

	// SKUs.
	$this->set_skus_query_args( $query_args );

	// IDs.
	$this->set_ids_query_args( $query_args );

	// Set specific types query args.
	if ( method_exists( $this, "set_{$this->type}_query_args" ) ) {
		$this->{"set_{$this->type}_query_args"}( $query_args );
	}

	// Attributes.
	$this->set_attributes_query_args( $query_args );

	// Categories.
	$this->set_categories_query_args( $query_args );

	// Tags.
	$this->set_tags_query_args( $query_args );

	$query_args = apply_filters( 'woocommerce_shortcode_products_query', $query_args, $this->attributes, $this->type );

	// Always query only IDs.
	$query_args['fields'] = 'ids';

	return $query_args;
}