post_date_gmt and post_date [duplicate]

From the comments in the WP_Post class in wp-includes/post.php: You can set the post date manually, by setting the values for ‘post_date’ and ‘post_date_gmt’ keys. So if you’re adding a post programmatically, and you want a date attached, you should set both keys. (If you leave them blank, WordPress will use the appropriate current date … Read more

Change date number to another language/script?

Please try this way: Change date, the_date, the_time to get_date, get_the_date, get_the_time. function KhmerNumDate ($text) { $text = str_replace(‘1’, ‘១’, $text); $text = str_replace(‘2’, ‘២’, $text); $text = str_replace(‘3’, ‘៣’, $text); $text = str_replace(‘4’, ‘៤’, $text); $text = str_replace(‘5’, ‘៥’, $text); $text = str_replace(‘6’, ‘៦’, $text); $text = str_replace(‘7’, ‘៧’, $text); $text = str_replace(‘8’, ‘៨’, … Read more

Echo Messages By Checking current_time()

You would just need to format the time that is returned by current_time() with the php date() function like this: $my_time = date(‘G’, current_time(‘timestamp’)); The param ‘G’ tells the function you just want to have the hour part (0 to 23) of the date. Have a look here: http://www.php.net/manual/en/function.date.php

datetime_timestamp shows numbers only? need in date and time

The date/time related field types for CMB2 store all their values as Unix timestamps in the database with the exception of text_datetime_timestamp_timezone which stores it’s value as a serialized DateTime object. text_date_timestamp Date Picker (UNIX timestamp) text_datetime_timestamp Text Date/Time Picker Combo (UNIX timestamp) text_datetime_timestamp_timezone Text Date/Time Picker/Time zone Combo (serialized DateTime object) See: https://github.com/WebDevStudios/CMB2/wiki/Field-Types What … Read more

How to check for WordPress timezone type?

If we want to work with php’s datetime features and timezone objects AND handle sites that use a gmt_offset, sadly it does require some trickery. I have not found a better way to do it than this: Check for timezone string first – got one – great! Else Check for gmt offset, then try to … Read more

WordPress returns a wrong date

As mmm said, wp stores all dates&times in gmt, but will show times as per the setting timezone. So you can cgange the timezone without the history needing to be updated. I prefer to use the php datetime when working with time. Gives better control and flexibility, eg if you want to show events in … Read more

SQL query to delete comments older than 90 days?

Regarding comments- what about the case where a comment older than 90 days has child replies younger than 90 days? for comment and pingback status, this should do it: UPDATE wp_posts SET comment_status=”closed”, ping_status=”closed” WHERE post_date < DATE_SUB(NOW(), INTERVAL 3 MONTH) AND post_status=”publish”;

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