WC_Shortcode_Products::parse_legacy_attributes( array $attributes )

Parse legacy attributes.


Description Description


Parameters Parameters

$attributes

(Required) Attributes.


Top ↑

Return Return

(array)


Top ↑

Source Source

File: includes/shortcodes/class-wc-shortcode-products.php

	protected function parse_legacy_attributes( $attributes ) {
		$mapping = array(
			'per_page' => 'limit',
			'operator' => 'cat_operator',
			'filter'   => 'terms',
		);

		foreach ( $mapping as $old => $new ) {
			if ( isset( $attributes[ $old ] ) ) {
				$attributes[ $new ] = $attributes[ $old ];
				unset( $attributes[ $old ] );
			}
		}

		return $attributes;
	}

Top ↑

Changelog Changelog

Changelog
Version Description
3.2.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

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