0
votes
0answers
32 views

Expire a post with meta_value after two weeks

I am trying to use the below code to query for some posts and then change a meta_value in order to "expire" it after two weeks time. I can't get this to work and it's difficult to test since I can ...
0
votes
0answers
17 views

Save automatically data to user profile once or twice a day [duplicate]

The main goal : I am working on a panel which will display statistics of my user websites (external website). For that, I use the Google Analytics API. I save the Google Analytics profile number in a ...
1
vote
1answer
150 views

Cron jobs in a class

Having: pluginname.php // If this file is called directly, abort. if ( ! defined( 'ABSPATH' ) ) { die(); } define('PLUGINNAME_PLUGIN_URL', plugin_dir_url( __FILE__ )); ...
3
votes
1answer
168 views

Which action for triggering cron “wp”or “init”?

Which one do you recommend using within a plugin and why? add_action( 'wp', 'trigger_me' ); function trigger_me() { if ( !wp_next_scheduled( 'my_plugin_cron' ) ) { ...
0
votes
1answer
475 views

A unique wp_schedule_single_event() for each post?

I'm building a site for a client that requires sending out emails about each post at various dates (i.e. two weeks before after the post was published, then again four weeks after the post was ...
11
votes
1answer
5k views

How to test wp_cron?

This is kind of a stupid question... I scheduled a action to run every hour: if(!wp_next_scheduled('my_hourly_events')) wp_schedule_event(time(), 'hourly', 'my_hourly_events'); ...