WC_Shortcode_Products::set_ids_query_args
Set ids query args.
Method of the class: WC_Shortcode_Products{}
No Hooks.
Returns
null. Nothing (null).
Usage
// protected - for code of main (parent) or child class $result = $this->set_ids_query_args( $query_args );
- $query_args(array) (required) (passed by reference — &)
- Query args.
Changelog
| Since 3.2.0 | Introduced. |
WC_Shortcode_Products::set_ids_query_args() WC Shortcode Products::set ids query args code WC 10.6.2
protected function set_ids_query_args( &$query_args ) {
if ( ! empty( $this->attributes['ids'] ) ) {
$ids = array_map( 'trim', explode( ',', $this->attributes['ids'] ) );
if ( 1 === count( $ids ) ) {
$query_args['p'] = $ids[0];
} else {
$query_args['post__in'] = $ids;
}
}
}