我有一个代码,用cronjob定期更改元值。这个鳕鱼不属于wordpress。它只更新前8个产品。WordPress的查询更新没有更新所有文章
$args = array(
'post_type' => 'product',
'post_status' => 'publish',
'meta_key' => '_sale_price',
);
$the_query = new WP_Query($args);
while($the_query->have_posts()) : $the_query->the_post();
update_post_meta(get_the_ID(), "_regular_price", '$new_value');
endwhile;
如何更改所有后期元值?
谢谢您的回复。它工作得很好。正如你所说的那样,这仅仅是一个例子。但是当我挖掘该项目时,我发现我需要更多的查询。我可以通过“$ data * _regular_price”更改此值,其中仅_sale_price = 10? –