How to Delete Old Comments by Date?
You could easily do this using mysql: DELETE FROM wp_comments WHERE comment_date < DATE_ADD(CURDATE(), INTERVAL -6 MONTH)
You could easily do this using mysql: DELETE FROM wp_comments WHERE comment_date < DATE_ADD(CURDATE(), INTERVAL -6 MONTH)
WordPress essentially completely ignores native PHP date functionality, in favor of its own handling. That traditionally allowed it to manage related aspects (such as timezones and translation) with no regards for server configuration. My educated guess that it would be largely oblivious to such change. At most the cron tasks might fire in bulk and … Read more
Serve visitor post time adjusted to their timezone
Right now you are performing the query by term, and displaying results instantly. What you need is to gather the results of each query, sort them and then display separately. Make sure to read code comments. /* $custom_terms = get_terms(‘columna’); – this approach is depreciated */ $custom_terms = get_terms( array( ‘taxonomy’ => ‘columna’ ) ); … Read more
You might try to include the the template.php file: <?php if( ! function_exists( ‘touch_time’ ) ) { require_once( ABSPATH . ‘/wp-admin/includes/template.php’ ); touch_time( 0, 0, 5 ); } ?> but I think it might be better to just copy the code from the touch_time() function into your own function and modify accordingly. Friday part of … Read more
You’d have to specify day, month, and year to get today’s posts: $my_query = new WP_Query( array( ‘cat’=>1, ‘year’=>date(‘Y’), ‘monthnum’=>date(‘m’), ‘day’=>date(‘d’), ‘posts_per_page’=>-1 ) ); Leaving day blank just doesn’t set that query var, so its not restricting your query at all.
As most template tags that start with the_ this one echoes time and not returns it (which template tags that start with get_the_ do). First the_time() fires and echoes year, then its return (null) gets concatenated and echoed with string. So: echo ‘Archive for ‘; the_time(‘Y’); Or: echo ‘Archive for ‘ . get_the_time(‘Y’);
WordPress has a special function for translating dates, called date_i18n. General usage: echo date_i18n( $dateformatstring, $unixtimestamp, $gmt); Supposing you have German as your site’s language this would be: echo date_i18n( ‘j. F Y’, false, false); You can also import the time format from the admin settings, like this: echo date_i18n(get_option(‘date_format’), false, false);
Don’t know of a plugin but you can use wp_schedule_single_event function. First create a meta box that takes to values: time for removal and what category we want to set it to when removed from featured. /* hook meta box */ add_action(“admin_init”, “admin_init”); /* hook meta box function */ function admin_init(){ add_meta_box(“Featured Removal”, “Featured Removal”, … Read more
Here are two ideas for your date_query part: 1) After 2 days ago: If you need posts published after current time, 2 days ago: ‘date_query’ => array( array( ‘after’ => ‘2 days ago’, // or ‘-2 days’ ‘inclusive’ => true, ), ), then the corresponding SQL part is: post_date >= ‘2014-09-09 17:57:15’ if the current … Read more