Support » Plugin: WooCommerce » Get tags and query posts by tags in Woocommerce

  • Hello,
    I’ve been pulling my hair out for now 3 hours without finding any solution. I’m trying to query posts with same tag as my product tag.
    I can echo my tag before my query (see first line of code), it works, but then inside the query it all goes wrong.

    <?php echo $product->get_tags(); ?>
         $producttags = get_tags();
    if ($producttags) {
        foreach($producttags as $tag) {
            $tag = $tag->slug;  break;
        while (have_posts()) : the_post(); ?>
        <div class="actucontent">
            <?php the_title(); ?>
          <?php the_content(); ?>
          <?php echo $tag ?> </div>
        <?php endwhile;

    BTW, webpage is
    Any idea someone ?
    Thank you,

  • The topic ‘Get tags and query posts by tags in Woocommerce’ is closed to new replies.