Wordpress plugin - how to run a plugin randomly

I need to create a functionality on a wordpress plugin:

I need to insert a random numbers of time every day some information to a db table.

How would you do this in WordPress?

Solutions

Take a look at wp_schedule_event its a cronjob.
A cron does run at a regular interval so you have to check the random part during the regular run of the cron

more WP cron:
http://codex.wordpress.org/Category:WP-Cron_Functions
http://wpengineer.com/1908/use-wordpress-cron/ <- tutorial

Similar questions

Jquery code won't run loaded from footer, but run from console
I'm trying to get a value and pass it to a hidden input in order to send form data via $_POST. I have a dropdown button and the following code in order to update the value when a user select an option: The code is supposed to pass the value from one button to another, as shown in here the example, but, when I load the code from WordPress header/foo...
Wamp server won't run the localhost project but run the localhost/phpmyadmin.I face this issue after install the SQL server
I changed the port 80 to 81. When I enter the url localhost:81/test/ it automatically redirect to localhost/test/ and show the below error but localhost:81/phpmyadmin is working As you see in the screen shot Requested URL http://localhost:80/test/ Physical Path C:\inetpub\wwwroot\test\ Request URl automatically take localhost:80 instead of localhos...
Python script doesn't work when i run it with "python3 absolute path" but work when i navigate on the folder then run
i have to implement a python script in a wordpress project. so first i tried to run it from command line and it work correctly when i open my bash from the folder and run it but when i tried to run it by drag and drop, it return me the following error for my project, i need to make it work when i use the command "python3 absolute/path" ca...
Set featured image randomly from Wordpress Database on post submission
Basically every time that I publish a post I want that a random image from my wordpress database be set as the feature image for that post. Can someone help me with this please!
Wordpress randomly redirects with 301 after logging in
Situation I'm trying to host 2 Wordpress websites on the same virtual machine. Each site has its own Wordpress installation and database (not multisite). Environment Problem After installing both Wordpress websites and logging in on wp-admin. The last one starts redirecting to the other one with a 301 redirect. Steps to reproduce: This is not alway...
PHP
Elementor or Wordpress randomly adds the word “array” to my custom widget
I'm building a custom widget for elementor to help my client add items to the website on his own without coding knowledge. I almost had it finished when I ran into a very strange issue. A button I have set up to link to a new page is putting the text "array" into itself for some reason. I've tried putting in text where the "array" text is directly ...

Also ask

We use cookies to deliver the best possible experience on our website. By continuing to use this site, accepting or closing this box, you consent to our use of cookies. To learn more, visit our privacy policy.