Changeset 2793124
- Timestamp:
- 10/02/2022 06:32:58 PM (4 years ago)
- Location:
- auto-delete-post
- Files:
-
- 6 added
- 2 edited
-
tags/1.1.1 (added)
-
tags/1.1.1/assets (added)
-
tags/1.1.1/assets/css (added)
-
tags/1.1.1/assets/css/style.css (added)
-
tags/1.1.1/auto-delete-post.php (added)
-
tags/1.1.1/readme.txt (added)
-
trunk/auto-delete-post.php (modified) (4 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
auto-delete-post/trunk/auto-delete-post.php
r2790974 r2793124 4 4 * Plugin URI: https://wordpress.org/plugin/auto-delete-post 5 5 * Description: This plugin automatically deletes a post after a certain time 6 * Version: 1.1 6 * Version: 1.1.1 7 7 * Requires at least: 5.2 8 8 * Requires PHP: 7.2 … … 18 18 * All constants 19 19 */ 20 21 20 // Constants for version 22 $adp_version = '1.1 ';21 $adp_version = '1.1.1'; 23 22 define( 'ADP_VERSION', $adp_version ); 24 23 … … 41 40 add_action( 'add_meta_boxes', [ $this, 'adp_create_auto_delete_post_meta_box' ] ); 42 41 add_action( 'save_post', [ $this, 'adp_save_auto_delete_post_meta_box' ] ); 42 add_action( 'init', [ $this, 'delete' ] ); 43 43 } 44 44 … … 72 72 } 73 73 } 74 75 // auto post deletion mechanism 76 public function delete() { 77 $adp_custom_query = new WP_Query( array( 78 'post_type' => 'post', 79 'posts_per_page' => -1, 80 )); 81 if( $adp_custom_query->have_posts() ) { 82 while( $adp_custom_query->have_posts() ) { 83 $adp_custom_query->the_post(); 84 85 $unique_post_id = get_the_ID(); 86 $final_meta_value = get_post_meta( $unique_post_id, 'auto_delete_post_time_key', true ); 87 $converted_user_date_time = strtotime( $final_meta_value ); 88 $converted_in_date_format = date('Y-m-d H:i', $converted_user_date_time).' '; 89 $final_user_date_time = strtotime( $converted_in_date_format ); 90 $current_server_time = current_time('timestamp'); 91 if( $current_server_time >= $final_user_date_time && $final_user_date_time > 0 ) { 92 wp_delete_post( $unique_post_id ); 93 } 94 } 95 } 96 97 wp_reset_postdata(); 98 } 74 99 } 75 100 76 101 $obj = new ADP_Auto_Delete_Post(); // class initialization 77 102 78 // auto post deletion mechanism 79 add_action( 'wp_head', 'delete' ); 80 function delete() { 81 $adp_custom_query = new WP_Query( array( 82 'post_type' => 'post', 83 'posts_per_page' => -1, 84 )); 85 if( $adp_custom_query->have_posts() ) { 86 while( $adp_custom_query->have_posts() ) { 87 $adp_custom_query->the_post(); 88 89 $unique_post_id = get_the_ID(); 90 $final_meta_value = get_post_meta( $unique_post_id, 'auto_delete_post_time_key', true ); 91 $converted_user_date_time = strtotime( $final_meta_value ); 92 $converted_in_date_format = date('Y-m-d H:i', $converted_user_date_time).' '; 93 $final_user_date_time = strtotime( $converted_in_date_format ); 94 $current_server_time = current_time('timestamp'); 95 if( $current_server_time >= $final_user_date_time && $final_user_date_time > 0 ) { 96 wp_delete_post( $unique_post_id ); 97 } 98 } 99 } 100 101 wp_reset_postdata(); 102 103 } 103 104 -
auto-delete-post/trunk/readme.txt
r2790983 r2793124 6 6 Requires at least: 5.2 7 7 Tested up to: 6.0 8 Version: 1.1 9 Stable tag: 1.1 8 Version: 1.1.1 9 Stable tag: 1.1.1 10 10 License: GPLv2 or later 11 11 License URI: http://www.gnu.org/licenses/gpl-2.0.html 12 12 13 13 == Description == 14 Delete your any blog post automatically after a certain time. This plugin will help you to delete a post after expiration of the given time which you can set during a post publish. Set a time from the time and date input field , refresh your front end and be tension free! The plugin will do the rest.14 Delete your any blog post automatically after a certain time. This plugin will help you to delete a post after expiration of the given time which you can set during a post publish. Set a time from the time and date input field and be tension free! The plugin will do the rest for you. 15 15 16 16 … … 38 38 == Changelog == 39 39 40 = 1.1 =41 Fixed some bug.40 = 1.1.1 = 41 Done some minor changes. 42 42 43 43 == Upgrade Notice == 44 44 45 = 1.1 =45 = 1.1.1 = 46 46 There is a upgrade available.
Note: See TracChangeset
for help on using the changeset viewer.