admin管理员组文章数量:1289345
Is there a way to add "new" tag for products, for products that have less than 14 days? I searched all over the internet, but I didn't find a solution. Please help me to do that with php, I will really appreciate. Thanks in advance! I have this code, but it doesn't work
function add_tags() {
$args = array(
'post_type' => 'product',
'posts_per_page' => -1
);
$loop = new WP_Query( $args );
if ( $loop->have_posts() ): while ( $loop->have_posts() ): $loop->the_post();
global $product;
wp_set_object_terms($product, array('nou'), 'product_tag');
endwhile; endif; wp_reset_postdata();
}
本文标签: woocommerce offtopicAdd quotnewquot tag for existing products
版权声明:本文标题:woocommerce offtopic - Add "new" tag for existing products 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741475664a2380866.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论