Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.
Closed 6 years ago.
Improve this questionI 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!
Closed. This question is off-topic. It is not currently accepting answers.Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.
Closed 6 years ago.
Improve this questionI 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/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.