Pass an array within a query string?

I am using Visual Composer in a WordPress site.
Visual Composer have function called “Post Grid”, which allows to show posts in grid based on different values.

I have created 3 custom post types called shoes, cloth and jackets.

I have created 1 post in each post type and put these 3 post in category called Brand. This category have ID = 9.

In Visual Composer plugin there is option to get data from “Custom Query”.

enter image description here

What i trying to accomplish is to show all posts from same brand in this “Post Grid”.

So far i only got this input field to work with a query string like this:

post_type=shoes?cat=9

This return correct post from this post type with the correct brand category, but i want it to return all posts from this category, regardless of post type.

I have also tried to pass an array like this:

post_type[]=shoes&post_type[]=cloth&post_type[]=jackets&cat=9

but this does not work. It return this output:

=shoes&post_type[]=cloth&post_type[]=jackets&cat=9″]

Looks like square brackets exit the shortcode used by Visual Composer.

WPBakery (author of Visual Composer) just told me the following:

“Post Grid element allows using Custom query which are written in a WordPress native way – by using it you can build any query you like…”

Any suggestion on how to pass array in querystring without having VC break code because of shortcode?


Source: shortcode

Leave a Reply