Use cron to create a non blocking task

For instance, since the configured cron tasks will only be run on page load, the task might not be run at the desired interval if there are no visitors. To prevent this, you need to use your operating system’s task scheduler. For this, you need to define define(‘DISABLE_WP_CRON’, true); in your wp-config.php file. After that, … Read more

WordPress function, Run using Crontab

define(‘DISABLE_WP_CRON’, true); This line disables the default behaviour of WP Cron. Which is being triggered by a user that visits the site. This is bad for a couple of reasons (nobody might visit, tasks are started via apache handler instead of PHP CLI, …). Now, if you have disabled it, you need another way to … Read more

How to set intervals in cron jobs?

You can do this via wp_cron by using the following, function more_reccurences() { return array( ‘sixhourly’ => array(‘interval’ => 21600, ‘display’ => ‘Every 6 hours’), ); } add_filter(‘cron_schedules’, ‘more_reccurences’); then find the function that does the autopost and call it by if ( !wp_next_scheduled(‘autopost_function’) ) { wp_schedule_event(time(), ‘sixhourly’, ‘autopost_function’); } If you want to use … Read more

Generate Email if No Posts Within Time Period

You’ll need to set up a cron job that checks once a day to see if the latest post is more than seven days old. So, some where in a plugin file. Schedule a new event. Then hook into that event. Grab the post date, turn it into a unix time stamp, and compare that … Read more

How to do some action weekly?

Did you try this plugin? http://wordpress.org/extend/plugins/scheduled-post-delete/ //// Sorry for my mistake, I understood you wrong. Try by pasting this in your functions.php: function auto_cat_remove() { global $post; wp_schedule_single_event( time() + 604800, ‘remove_news_cat_event’, array( $post->ID ) ); } function remove_news_cat_func( $post_id ) { global $wpdb; $category_id = get_cat_ID( ‘news’ ); $wpdb->query( $wpdb->prepare( “DELETE FROM $wpdb->term_relationships WHERE … Read more