Sending emails to separate accounts using a for loop

For whatever reason, this part: for ($z = 1; $z <= $Number_of_Categories; $z++) is the offender. even though $Number_of_Categories was defined above where it is used, the value wasn’t holding. I had to build a function instead, and do this: function get_Number_of_Categories(){ return “2”; } for ($z = 1; $z <= get_Number_of_Categories(); $z++) once I … Read more

WordPress: Cron locking and Queue

Simple Cronjob Walker Create a CPT cronjob for your cronjobs. Add the relevant post meta data (action, last_executed,… and whatever you need) Create a walker function function my_cronjob_walker() { $args= array( ‘post_type’ => ‘cronjob’, ‘posts_per_page’ => 1, ‘meta_key’ => ‘last_executed’ ‘orderby’ => ‘meta_value’, ); $cronjob = new WP_Query($args); if ($cronjob->have_posts()) while ($cronjob->have_posts()) { $cronjob->the_post(); // … Read more

Schedule Removal of Menu Page and Shortcode

First, unless zeeshan is actually a function inside a class, do not use array($this,’zeeshan’). (If it is in a class, nevermind.) Second, even if this event is firing – it may or may not be? – the way you have it is only going to affect the current pageload when triggered, so is rather pointless. … Read more

Hourly events don’t get triggered

You probably don’t have enough visitors on your site. Although it looks otherwise WordPress doesn’t actually schedule the events. It writes the time when it should happen to the database, and only when somebody visits the site WP gets fired up, checks the database and fires the event. So, if nobody is around at the … Read more