• Hi Guys

    I need help in modifing this query in wp plugin please advice

    first the query

    $common_args = array(
    ‘post_type’ => ‘product’,
    ‘posts_per_page’ => $wpcs_total_products,
    ‘post_status’ => ‘publish’,
    ‘meta_key’ => ‘location_name’,
    ‘meta_value’ => $country

    right now this work fine with a little change i want to do i want single product from each category

    for example

    Product ID | Category ID |
    1 | 1
    2 | 1
    3 | 1
    4|2
    5|2
    6|3
    7|4
    8|4

    so output of query would be

    Product ID -> 1,4,6,7

    thanks in advance

The topic ‘executing a query in plugin’ is closed to new replies.