'; // print_r($params); // return; $ids = get_posts( $params ); // print_r($ids); // return; } $from = $_POST['distribute']; $to = current_time( 'timestamp', 0 ); if ( $from == 0 ) { $range = explode( '-', $_POST['range'] ); if ( count( $range ) == 2 ) { $from = strtotime( $range[0], $now ); $to = strtotime( $range[1], $now ); } else { $from = strtotime( '-3 hours', $now ); } } foreach ( $ids as $id ) { //TODO Get Last modified and published date and never backdate modified date $time = rand( $from, $to ); $time = date( "Y-m-d H:i:s", $time ); $time_gmt = get_gmt_from_date( $time ); if($field === 'date_both'){ $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET post_date ='%s', post_date_gmt='%s', post_modified ='%s', post_modified_gmt='%s' WHERE ID = %d", $time, $time_gmt, $time, $time_gmt, $id ) ); } else { $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET $field ='%s', {$field}_gmt='%s' WHERE ID = %d", $time, $time_gmt, $id ) ); } } $settings_saved = count( $ids ); } } wp_enqueue_script('momentjs','https://cdn.jsdelivr.net/momentjs/latest/moment.min.js'); wp_enqueue_script('daterangepicker','https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.min.js'); wp_enqueue_style('daterangepicker','https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.css'); wp_enqueue_style('bulkupdatedate',plugins_url( '/style.css', __FILE__ )); ?> 0 ) : ?> Rate 5 stars Tweet about Bulk Post Update Date true, '_builtin' => false ); $output = 'objects'; // 'names' or 'objects' (default: 'names') $operator = 'and'; // 'and' or 'or' (default: 'and') $post_types = get_post_types( $args, $output, $operator ); if ( $post_types ) { // If there are any custom public post types. foreach ( $post_types as $post_type ) { ?> menu_icon, 'dashicon') !== false){?> label ) ?> Custom Range Buy me a coffee! Buy me a coffee! Thank you for using Bulk Post Update Date. If you found the plugin useful buy me a coffee! Your donation will motivate and make me happy for all the efforts. You can donate via Fiverr. Developed with ♥ by Atiq Samtia | GitHub | Support | Translate | Rate it (★★★★★) on WordPress.org, if you like this plugin.
Thank you for using Bulk Post Update Date. If you found the plugin useful buy me a coffee! Your donation will motivate and make me happy for all the efforts. You can donate via Fiverr.
Developed with ♥ by Atiq Samtia | GitHub | Support | Translate | Rate it (★★★★★) on WordPress.org, if you like this plugin.