wp_schedule_event will it run if timestamp has passed?

Yes, the event will trigger when the wp-cron process gets run. If something is preventing wp-cron from running, then it won’t trigger at all. If you’re having it not work, then something about your server configuration is preventing it from working. For these cases, you can generally work around them by adding this define to … Read more

How to make debug.log timestamps local time?

What is the time zone setup in your admin -> settings -> general page? WordPress overrides & kind of disregards php’s timezone & uses this own settings , if haven’t set this – default is UTC+0 Update: according to https://core.trac.wordpress.org/ticket/39595 – wordpress has forced this to be UTC

Modify human_time_diff() to shorten “days” to “d” and “hours” to “h” etc

There is no filter for output of that function. You can fork (copy/rename/edit) it or add wrapper that will replace strings in output like this: function short_time_diff( $from, $to = ” ) { $diff = human_time_diff($from,$to); $replace = array( ‘hour’ => ‘h’, ‘hours’ => ‘h’, ‘day’ => ‘d’, ‘days’ => ‘d’, ); return strtr($diff,$replace); } … Read more

When does next Cron Job run (time from now)?

Edit: wp_next_scheduled() returns the timestamp of the next scheduled job of a specified wp-cron job-arguments pair. Please note that this differs slightly in functionality to the answer below, in that you have to provide the arguments passed to cron job’s callback (if it has any). The original answer would provide the time of the next … Read more

How can i put “posted x minutes ago on my posts?

function k99_relative_time() { $post_date = get_the_time(‘U’); $delta = time() – $post_date; if ( $delta < 60 ) { echo ‘Less than a minute ago’; } elseif ($delta > 60 && $delta < 120){ echo ‘About a minute ago’; } elseif ($delta > 120 && $delta < (60*60)){ echo strval(round(($delta/60),0)), ‘ minutes ago’; } elseif ($delta … Read more

Change HTML Produced by wp_list_comments()

Here are some options on how we can override the native layout for each comment: Approach #1 – Overriding start_el() with a custom walker Let’s define our custom wpse comment format: // Arguments for wp_list_comments() $args = [ ‘style’ => ‘ol’, ‘format’ => ‘html5’, ‘short_ping’ => true, ]; // Use our custom walker if it’s … Read more

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