Delete Duplicate Posts - Version 4.4.3

Version Description

  • 2020/05/07
  • Plugin now looks for duplicates in posts and pages per default, no need to set it after activating plugin.
  • Fix: "Error deleting post" showing even if the post was deleted. Thank you Murray :-)
  • The log is now updated when list of duplicates is updated.
  • 225,725 downloads
Download this release

Release Info

Developer cleverplugins
Plugin Icon 128x128 Delete Duplicate Posts
Version 4.4.3
Comparing to
See all releases

Code changes from version 4.4.2 to 4.4.3

delete-duplicate-posts.php CHANGED
@@ -5,7 +5,7 @@ Plugin Name: Delete Duplicate Posts
5
  Plugin Script: delete-duplicate-posts.php
6
  Plugin URI: https://cleverplugins.com
7
  Description: Remove duplicate blogposts on your blog! Searches and removes duplicate posts and their post meta tags. You can delete posts, pages and other Custom Post Types enabled on your website.
8
- Version: 4.4.2
9
  Author: cleverplugins.com
10
  Author URI: https://cleverplugins.com
11
  Min WP Version: 4.7
@@ -27,6 +27,10 @@ if ( !function_exists( 'ddp_fs' ) ) {
27
  if ( !isset( $ddp_fs ) ) {
28
  // Include Freemius SDK.
29
  require_once dirname( __FILE__ ) . '/freemius/start.php';
 
 
 
 
30
  $ddp_fs = fs_dynamic_init( array(
31
  'id' => '925',
32
  'slug' => 'delete-duplicate-posts',
@@ -333,7 +337,7 @@ if ( !class_exists( 'Delete_Duplicate_Posts' ) ) {
333
  'ddp_running' => 'false',
334
  'ddp_keep' => 'oldest',
335
  'ddp_limit' => 50,
336
- 'ddp_pts' => array(),
337
  'ddp_statusmail_recipient' => '',
338
  'ddp_statusmail' => 0,
339
  'ddp_enabled' => 0,
@@ -424,29 +428,23 @@ if ( !class_exists( 'Delete_Duplicate_Posts' ) ) {
424
  self::timerstart( 'deletepost_' . $postid );
425
  $result = wp_delete_post( $postid, true );
426
  $timespent = self::timerstop( 'deletepost_' . $postid );
 
 
427
 
428
- if ( !$result ) {
429
- self::log( sprintf( __( "Error, problem deleting %1\$s '%2\$d'", 'delete-duplicate-posts' ), $dupe['type'], $postid ) );
 
430
  } else {
431
- $dispcount++;
432
- $totaldeleted = get_option( 'ddp_deleted_duplicates' );
433
-
434
- if ( false !== $totaldeleted ) {
435
- $totaldeleted++;
436
- update_option( 'ddp_deleted_duplicates', $totaldeleted );
437
- } else {
438
- update_option( 'ddp_deleted_duplicates', 1 );
439
- }
440
-
441
- self::log( sprintf(
442
- __( "Deleted %1\$s '%2\$s' (id: %3\$s) in %4\$s sec.", 'delete-duplicate-posts' ),
443
- $dupe['type'],
444
- $title,
445
- $postid,
446
- $timespent
447
- ) );
448
  }
449
-
 
 
 
 
 
 
 
450
  }
451
 
452
  }
@@ -589,6 +587,11 @@ if ( !class_exists( 'Delete_Duplicate_Posts' ) ) {
589
  }
590
 
591
  $options = self::get_options();
 
 
 
 
 
592
  self::save_options( $options );
593
  wp_clear_scheduled_hook( 'ddp_cron' );
594
  self::log( __( 'Plugin activated.', 'delete-duplicate-posts' ) );
5
  Plugin Script: delete-duplicate-posts.php
6
  Plugin URI: https://cleverplugins.com
7
  Description: Remove duplicate blogposts on your blog! Searches and removes duplicate posts and their post meta tags. You can delete posts, pages and other Custom Post Types enabled on your website.
8
+ Version: 4.4.3
9
  Author: cleverplugins.com
10
  Author URI: https://cleverplugins.com
11
  Min WP Version: 4.7
27
  if ( !isset( $ddp_fs ) ) {
28
  // Include Freemius SDK.
29
  require_once dirname( __FILE__ ) . '/freemius/start.php';
30
+ // Check anonymous mode - with love from WSAL
31
+ // $freemius_state = get_site_option( 'ddp_freemius_state', 'anonymous' );
32
+ // $is_anonymous = ( 'anonymous' === $freemius_state || 'skipped' === $freemius_state );
33
+ // $is_anonymous = false;
34
  $ddp_fs = fs_dynamic_init( array(
35
  'id' => '925',
36
  'slug' => 'delete-duplicate-posts',
337
  'ddp_running' => 'false',
338
  'ddp_keep' => 'oldest',
339
  'ddp_limit' => 50,
340
+ 'ddp_pts' => array( 'post', 'page' ),
341
  'ddp_statusmail_recipient' => '',
342
  'ddp_statusmail' => 0,
343
  'ddp_enabled' => 0,
428
  self::timerstart( 'deletepost_' . $postid );
429
  $result = wp_delete_post( $postid, true );
430
  $timespent = self::timerstop( 'deletepost_' . $postid );
431
+ $dispcount++;
432
+ $totaldeleted = get_option( 'ddp_deleted_duplicates' );
433
 
434
+ if ( false !== $totaldeleted ) {
435
+ $totaldeleted++;
436
+ update_option( 'ddp_deleted_duplicates', $totaldeleted );
437
  } else {
438
+ update_option( 'ddp_deleted_duplicates', 1 );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
439
  }
440
+
441
+ self::log( sprintf(
442
+ __( "Deleted %1\$s '%2\$s' (id: %3\$s) in %4\$s sec.", 'delete-duplicate-posts' ),
443
+ $dupe['type'],
444
+ $title,
445
+ $postid,
446
+ $timespent
447
+ ) );
448
  }
449
 
450
  }
587
  }
588
 
589
  $options = self::get_options();
590
+ // @debug
591
+ error_log( '$options ' . print_r( $options, true ) );
592
+ $options = self::default_options();
593
+ // @debug
594
+ error_log( '$options ' . print_r( $options, true ) );
595
  self::save_options( $options );
596
  wp_clear_scheduled_hook( 'ddp_cron' );
597
  self::log( __( 'Plugin activated.', 'delete-duplicate-posts' ) );
js/delete-duplicate-posts.js CHANGED
@@ -4,7 +4,7 @@ jQuery(document).ready(function(){
4
  senddata['stepid'] = 0;
5
  ddp_get_duplicates(1,senddata);
6
 
7
- ddp_refresh_log();
8
 
9
 
10
  // DELETE DUPES
@@ -139,9 +139,10 @@ function ddp_get_duplicates( stepid, data, self ) {
139
 
140
 
141
  }
142
-
143
  }
144
  }).fail(function (response) {
 
145
  jQuery('#ddp_container #dashboard .spinner').removeClass('is-active');
146
 
147
  if ( window.console && window.console.log ) {
4
  senddata['stepid'] = 0;
5
  ddp_get_duplicates(1,senddata);
6
 
7
+
8
 
9
 
10
  // DELETE DUPES
139
 
140
 
141
  }
142
+ ddp_refresh_log();
143
  }
144
  }).fail(function (response) {
145
+ ddp_refresh_log();
146
  jQuery('#ddp_container #dashboard .spinner').removeClass('is-active');
147
 
148
  if ( window.console && window.console.log ) {
readme.txt CHANGED
@@ -5,7 +5,7 @@ License: GPLv2 or later
5
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
6
  Requires at least: 4.7
7
  Tested up to: 5.4.1
8
- Stable tag: 4.4.2
9
  Requires PHP: 5.6
10
 
11
  Get rid of duplicate posts and pages on your blog!
@@ -33,14 +33,19 @@ Yes! You should always take a backup before deleting posts or pages on your webs
33
  = What happens if it deletes something I do not want to delete? =
34
  You should restore the backup you took of your website before you ran this tool.
35
 
36
-
37
-
38
  == Screenshots ==
39
  1. Duplicate posts were found
40
  2. Details in the log
41
 
42
  == Changelog ==
43
 
 
 
 
 
 
 
 
44
  = 4.4.2 =
45
  * 2020/05/04
46
  * Fixing activation bugs - Thank you @locutus45 and @paul1427
5
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
6
  Requires at least: 4.7
7
  Tested up to: 5.4.1
8
+ Stable tag: 4.4.3
9
  Requires PHP: 5.6
10
 
11
  Get rid of duplicate posts and pages on your blog!
33
  = What happens if it deletes something I do not want to delete? =
34
  You should restore the backup you took of your website before you ran this tool.
35
 
 
 
36
  == Screenshots ==
37
  1. Duplicate posts were found
38
  2. Details in the log
39
 
40
  == Changelog ==
41
 
42
+ = 4.4.3 =
43
+ * 2020/05/07
44
+ * Plugin now looks for duplicates in posts and pages per default, no need to set it after activating plugin.
45
+ * Fix: "Error deleting post" showing even if the post was deleted. Thank you Murray :-)
46
+ * The log is now updated when list of duplicates is updated.
47
+ * 225,725 downloads
48
+
49
  = 4.4.2 =
50
  * 2020/05/04
51
  * Fixing activation bugs - Thank you @locutus45 and @paul1427