I have a product page and I wish to change the prices twice in a day automatically. I want it to repeat forever. So I have 2 options : schedule the page or the products. But I couldn’t find any plugin to do it or code (a plugin is better for me).

I tried asking the wordpress forum but there was no answer.

Please help me. Thank you!


Take a look at this page https://codex.wordpress.org/Function_Reference/wp_update_post . There is an example of how to update the post.

All you need is the post ID that you want to update, and some code to change certain text in the post.You will want to get the post's data (an array), then change the $post_content array item with some sort of process that searches for the price string you want to change and then adjusts it.

Once that is changed, set the $post_content array item to the new text (with your price change), and store the result. The example in the link above should get you pointed in the right direction.

Once you have the PHP file that does the process correctly (test it a lot!), then add that to the CRON.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.