No effect on updating the product

  • Member
    October 23, 2017 at 4:35 pm #260


    when I update my product manualy everything works fine. But when I update it via this function nothing happens. The function itself is working right.


    function test_mine() {
    global $post;
    $args = array(‘post_type’ => ‘product’,
    ‘numberposts’ => -1);
    $custom_posts = get_posts($args);
    foreach($custom_posts as $post) : setup_postdata($post);

    $my_post = array(
    ‘ID’ => get_the_ID(),
    ‘post_content’ => rand(1,1000)
    wp_update_post( $my_post );

    As you can see the post content is added to the product and updated properly. The new price of the product is entered by another plugin already. That´s why I need to update all products via a function to don´t manualy update every product by myself to trigger the price drop email.

    The only thing is that the email isn´t triggered when I excecute this function.

    Sorry, this forum is for verified users only. Please Login or Register to continue

Comments are closed.