PHP Warning on fresh install (Connection timed out)

The answer is apparently YES, I should worry. After some research, I’ve found that the warning seems to be related to misconfigurations on the server that WordPress is hosted on (ie. a problem with my server, not WordPress). Common misconfigurations: Server doesn’t have DNS, and so it can’t figure out who “example.com” is, even though … Read more

Do WordPress cron jobs slow down page loading?

Short answer – Nope. Any page request initializes the scheduled queue. It’s just an initialize request. Wp-cron request is a standalone request. so requesting URL /somepage you just initialize request to /wp-cron.php However – If cron event doesn’t work really well (it’s has 1000 db queries e.g. or its requesting a some really long-to-respond resource), … Read more

Converting timestamps to local time with date_l18n()

I know I’m three months late, but the function you want here is WordPress’ get_date_from_gmt(). The function accepts a GMT/UTC date in Y-m-d H:i:s format as the first parameter, and your desired date format as the second parameter. It’ll convert your date to the local timezone as set on the Settings screen. Example usage: echo … Read more

WP Cron Doesn’t Execute When Time Elapses

First can you please confirm that you don’t have any caching plugins enabled? Caching plugins can interfere with cron jobs because your visitors are not served a live page but a cached version of your page. If you have a caching plugin enabled, you can choose one of your pages, add an exclussion to your … Read more

How to run a function every 5 minutes?

You can create new schedule times via cron_schedules: function my_cron_schedules($schedules){ if(!isset($schedules[“5min”])){ $schedules[“5min”] = array( ‘interval’ => 5*60, ‘display’ => __(‘Once every 5 minutes’)); } if(!isset($schedules[“30min”])){ $schedules[“30min”] = array( ‘interval’ => 30*60, ‘display’ => __(‘Once every 30 minutes’)); } return $schedules; } add_filter(‘cron_schedules’,’my_cron_schedules’); Now you can schedule your function: wp_schedule_event(time(), ‘5min’, ‘my_schedule_hook’, $args); To only schedule … Read more

Running WP Cron on multisite the right way

I think the best way is to use WP-CLI but you’d need to write a bash script to do this. Here is one that should do it for you: WP_PATH=”/path/to/wp” for SITE_URL in = $(wp site list –fields=domain,path,archived,deleted –format=csv –path=”$WP_PATH” | grep “,0,0$” | awk -F ‘,’ ‘{print $1 $2}’) do for EVENT_HOOK in $(wp … Read more

How to test wp_cron?

My favorite plugin for that is Core Control which has very nice module for display of what is going in the cron – which events are set up, when are they next firing, etc. On getting your hands dirty level see _get_cron_array(), which returns internal stored data for cron events (top level of keys are … Read more

Is there a quick way to view the wp-cron schedule

Why don’t you just create a cron job, make a database dump and look where the info about the cron job is kept? That’s what I did. As suspected, WordPress 3.5.1 keeps its cron jobs in the {wp}_options table under the name ‘cron’. SELECT * FROM `wp_options` WHERE `option_name` LIKE ‘%cron%’ Or through functions.php: $cron_jobs … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)