Custom Query Filter Issue

Im creating a product custom argument post__in . It doesnt seems to work. It didnt change anything on the query. but posts_per_page works as a custom argument.

    $query_args['post__in'] = array(201, 202);
    $query_args['posts_per_page'] =2;

Im writing it like this.

Hello @kris,

If you are using the Products query type, then 'post_in' is not a valid parameter… Please refer to the proper parameters provided by WooCommerce: wc_get_products and WC_Product_Query · woocommerce/woocommerce Wiki · GitHub
As specified in the linked documentation, modify 'post_in' to 'include'.

Otherwise, if you insist on using 'post_in', simply use the Posts query type and modify the Post Type to Products from the Query Editor.

Moving to General.

Cheers,

thank you. it works now.

1 Like