WC_Shortcode_Products::parse_legacy_attributes
Parse legacy attributes.
Method of the class: WC_Shortcode_Products{}
No Hooks.
Returns
Array.
Usage
// protected - for code of main (parent) or child class $result = $this->parse_legacy_attributes( $attributes );
- $attributes(array) (required)
- Attributes.
Changelog
| Since 3.2.0 | Introduced. |
WC_Shortcode_Products::parse_legacy_attributes() WC Shortcode Products::parse legacy attributes code WC 10.5.0
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;
}