• I have a category named ‘My product Cat’. Its ID is 20. Now i have 1 product in this category. Usually in WordPress i use get_posts() function to get all the posts inside a category. But, you see here in my case it returns an empty array always. 🙁

    Here is my code :

    $args = array( 'numberposts' => 100,'category' => 20, 'post_type' => 'product');
    $product_array = get_posts($args);
    var_dump($product_array);

    Returns :

    array(0) {
    }

    What is wrong ?
    What i am missing ?

    http://wordpress.org/plugins/woocommerce/

  • The topic ‘Getting products from a category not working properly’ is closed to new replies.