Version Description
- 2020/05/02
- Tested up to WP 5.4.1
- Pro: Choose different post stati to look for; publish, draft, scheduled, pending, private and any other custom post status.
- Code improvement, works faster.
- 218,123 downloads
Download this release
Release Info
Developer | cleverplugins |
Plugin | Delete Duplicate Posts |
Version | 4.4 |
Comparing to | |
See all releases |
Code changes from version 4.3 to 4.4
- delete-duplicate-posts.php +162 -102
- js/delete-duplicate-posts.js +4 -4
- readme.txt +13 -4
- sidebar.php +16 -6
delete-duplicate-posts.php
CHANGED
@@ -5,11 +5,11 @@ 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.
|
9 |
Author: cleverplugins.com
|
10 |
Author URI: https://cleverplugins.com
|
11 |
Min WP Version: 4.7
|
12 |
-
Max WP Version: 5.4
|
13 |
Text Domain: delete-duplicate-posts
|
14 |
Domain Path: /languages
|
15 |
*/
|
@@ -236,6 +236,7 @@ if ( !class_exists( 'Delete_Duplicate_Posts' ) ) {
|
|
236 |
}
|
237 |
|
238 |
$ddp_pts = rtrim( $ddp_pts, ',' );
|
|
|
239 |
$order = $options['ddp_keep'];
|
240 |
// verify default value has been set
|
241 |
|
@@ -258,7 +259,7 @@ if ( !class_exists( 'Delete_Duplicate_Posts' ) ) {
|
|
258 |
|
259 |
if ( 'titlecompare' === $comparemethod ) {
|
260 |
// @todo - prepare - not urgent, there is no way to exploit this query
|
261 |
-
$thisquery = "
|
262 |
$dupes = $wpdb->get_results( $thisquery, ARRAY_A );
|
263 |
|
264 |
if ( $dupes ) {
|
@@ -274,6 +275,7 @@ if ( !class_exists( 'Delete_Duplicate_Posts' ) ) {
|
|
274 |
'orgID' => $dupe['save_this_post_id'],
|
275 |
'orgtitle' => get_the_title( $dupe['save_this_post_id'] ),
|
276 |
'orgpermalink' => get_permalink( $dupe['save_this_post_id'] ),
|
|
|
277 |
'why' => '',
|
278 |
);
|
279 |
$json_response['dupes'][] = $dupedetails;
|
@@ -326,6 +328,7 @@ if ( !class_exists( 'Delete_Duplicate_Posts' ) ) {
|
|
326 |
'ddp_pts' => array(),
|
327 |
'ddp_statusmail_recipient' => '',
|
328 |
'ddp_enabled' => 0,
|
|
|
329 |
);
|
330 |
return $defaults;
|
331 |
}
|
@@ -642,6 +645,7 @@ if ( !class_exists( 'Delete_Duplicate_Posts' ) ) {
|
|
642 |
|
643 |
public static function admin_options_page()
|
644 |
{
|
|
|
645 |
// DELETE NOW
|
646 |
if ( isset( $_POST['deleteduplicateposts_delete'] ) && isset( $_POST['_wpnonce'] ) ) {
|
647 |
|
@@ -693,7 +697,6 @@ if ( !class_exists( 'Delete_Duplicate_Posts' ) ) {
|
|
693 |
if ( isset( $_POST['ddp_method'] ) ) {
|
694 |
$this->options['ddp_method'] = sanitize_text_field( $_POST['ddp_method'] );
|
695 |
}
|
696 |
-
global $ddp_fs ;
|
697 |
$this->options['ddp_pts'] = $posttypes;
|
698 |
// Previously sanitized
|
699 |
if ( isset( $_POST['ddp_limit'] ) ) {
|
@@ -898,66 +901,123 @@ if ( !class_exists( 'Delete_Duplicate_Posts' ) ) {
|
|
898 |
<p class="description">Choose which post types to scan for duplicates.</p>
|
899 |
</td>
|
900 |
</tr>
|
901 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
902 |
$comparemethod = 'titlecompare';
|
903 |
global $ddp_fs ;
|
904 |
?>
|
905 |
-
|
906 |
-
|
907 |
esc_html_e( 'Comparison Method', 'delete-duplicate-posts' );
|
908 |
?></th>
|
909 |
-
|
910 |
-
|
911 |
|
912 |
-
|
913 |
-
|
914 |
-
|
915 |
checked( 'titlecompare', $comparemethod );
|
916 |
?> /> Compare by title (default)
|
917 |
-
|
918 |
-
|
919 |
|
920 |
-
|
921 |
|
922 |
-
|
923 |
global $ddp_fs ;
|
924 |
?>
|
925 |
-
|
926 |
-
|
927 |
-
|
928 |
-
|
929 |
-
|
930 |
esc_html_e( 'Delete which posts?:', 'delete-duplicate-posts' );
|
931 |
?></label></th><td>
|
932 |
|
933 |
-
|
934 |
-
|
935 |
-
|
936 |
if ( 'oldest' === $options['ddp_keep'] ) {
|
937 |
echo 'selected="selected"' ;
|
938 |
}
|
939 |
?>
|
940 |
-
|
941 |
esc_html_e( 'Keep oldest', 'delete-duplicate-posts' );
|
942 |
?></option>
|
943 |
-
|
944 |
-
|
945 |
if ( 'latest' === $options['ddp_keep'] ) {
|
946 |
echo 'selected="selected"' ;
|
947 |
}
|
948 |
?>
|
949 |
-
|
950 |
esc_html_e( 'Keep latest', 'delete-duplicate-posts' );
|
951 |
?></option>
|
952 |
-
|
953 |
-
|
954 |
esc_html_e( 'Keep the oldest or the latest version of duplicates? Default is keeping the oldest, and deleting any subsequent duplicate posts', 'delete-duplicate-posts' );
|
955 |
?></p>
|
956 |
-
|
957 |
-
|
958 |
|
959 |
|
960 |
-
|
961 |
/*
|
962 |
|
963 |
<tr valign="top">
|
@@ -980,152 +1040,152 @@ if ( !class_exists( 'Delete_Duplicate_Posts' ) ) {
|
|
980 |
*/
|
981 |
?>
|
982 |
|
983 |
-
|
984 |
-
|
985 |
-
|
986 |
|
987 |
|
988 |
|
989 |
-
|
990 |
-
|
991 |
esc_html_e( 'Enable automatic deletion?:', 'delete-duplicate-posts' );
|
992 |
?>
|
993 |
|
994 |
-
|
995 |
-
|
996 |
-
|
997 |
-
|
998 |
if ( true === $options['ddp_enabled'] ) {
|
999 |
echo 'checked="checked"' ;
|
1000 |
}
|
1001 |
?>
|
1002 |
-
|
1003 |
-
|
1004 |
esc_html_e( 'Clean duplicates automatically.', 'delete-duplicate-posts' );
|
1005 |
?></p>
|
1006 |
-
|
1007 |
-
|
1008 |
-
|
1009 |
|
1010 |
|
1011 |
-
|
1012 |
-
|
1013 |
esc_html_e( 'How often?:', 'delete-duplicate-posts' );
|
1014 |
?></label></th><td>
|
1015 |
|
1016 |
-
|
1017 |
-
|
1018 |
$schedules = wp_get_schedules();
|
1019 |
if ( $schedules ) {
|
1020 |
foreach ( $schedules as $key => $sch ) {
|
1021 |
?>
|
1022 |
-
|
1023 |
echo esc_attr( $key ) ;
|
1024 |
?>"
|
1025 |
-
|
1026 |
if ( esc_attr( $key ) === $options['ddp_schedule'] ) {
|
1027 |
echo esc_html( 'selected="selected"' ) ;
|
1028 |
}
|
1029 |
?>
|
1030 |
-
|
1031 |
echo esc_html( $sch['display'] ) ;
|
1032 |
?></option>
|
1033 |
-
|
1034 |
}
|
1035 |
}
|
1036 |
?>
|
1037 |
-
|
1038 |
-
|
1039 |
esc_html_e( 'How often should the cron job run?', 'delete-duplicate-posts' );
|
1040 |
?></p>
|
1041 |
-
|
1042 |
-
|
1043 |
|
1044 |
|
1045 |
|
1046 |
-
|
1047 |
-
|
1048 |
-
|
1049 |
|
1050 |
-
|
1051 |
-
|
1052 |
esc_html_e( 'Send status mail?:', 'delete-duplicate-posts' );
|
1053 |
?></th>
|
1054 |
-
|
1055 |
-
|
1056 |
-
|
1057 |
-
|
1058 |
if ( true === $options['ddp_statusmail'] ) {
|
1059 |
echo 'checked="checked"' ;
|
1060 |
}
|
1061 |
?>
|
1062 |
-
|
1063 |
esc_html_e( 'Sends a status email if duplicates have been found.', 'delete-duplicate-posts' );
|
1064 |
?></p>
|
1065 |
-
|
1066 |
-
|
1067 |
-
|
1068 |
|
1069 |
-
|
1070 |
-
|
1071 |
esc_html_e( 'Email recipient:', 'delete-duplicate-posts' );
|
1072 |
?></th>
|
1073 |
-
|
1074 |
-
|
1075 |
|
1076 |
-
|
1077 |
echo esc_html( $options['ddp_statusmail_recipient'] ) ;
|
1078 |
?>">
|
1079 |
-
|
1080 |
esc_html_e( 'Who should get the notification email.', 'delete-duplicate-posts' );
|
1081 |
?></p>
|
1082 |
-
|
1083 |
-
|
1084 |
-
|
1085 |
|
1086 |
|
1087 |
|
1088 |
|
1089 |
-
|
1090 |
esc_html_e( 'Save Settings', 'delete-duplicate-posts' );
|
1091 |
?>" /></th>
|
1092 |
-
|
1093 |
|
1094 |
-
|
1095 |
|
1096 |
-
|
1097 |
-
|
1098 |
|
1099 |
|
1100 |
-
|
1101 |
|
1102 |
-
|
1103 |
esc_html_e( 'The Log', 'delete-duplicate-posts' );
|
1104 |
?></h3>
|
1105 |
-
|
1106 |
-
|
1107 |
-
|
1108 |
|
1109 |
-
|
1110 |
-
|
1111 |
-
|
1112 |
-
|
1113 |
wp_nonce_field( 'ddp_clearlog_nonce' );
|
1114 |
?>
|
1115 |
|
1116 |
-
|
1117 |
esc_html_e( 'Reset log', 'delete-duplicate-posts' );
|
1118 |
?>" />
|
1119 |
-
|
1120 |
-
|
1121 |
|
1122 |
-
|
1123 |
|
1124 |
-
|
1125 |
include_once 'sidebar.php';
|
1126 |
?>
|
1127 |
|
1128 |
-
|
1129 |
|
1130 |
if ( function_exists( 'ddp_fs' ) ) {
|
1131 |
global $ddp_fs ;
|
@@ -1161,7 +1221,7 @@ if ( !class_exists( 'Delete_Duplicate_Posts' ) ) {
|
|
1161 |
|
1162 |
|
1163 |
</div>
|
1164 |
-
|
1165 |
}
|
1166 |
|
1167 |
}
|
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
|
9 |
Author: cleverplugins.com
|
10 |
Author URI: https://cleverplugins.com
|
11 |
Min WP Version: 4.7
|
12 |
+
Max WP Version: 5.4.1
|
13 |
Text Domain: delete-duplicate-posts
|
14 |
Domain Path: /languages
|
15 |
*/
|
236 |
}
|
237 |
|
238 |
$ddp_pts = rtrim( $ddp_pts, ',' );
|
239 |
+
$post_stati = '"publish"';
|
240 |
$order = $options['ddp_keep'];
|
241 |
// verify default value has been set
|
242 |
|
259 |
|
260 |
if ( 'titlecompare' === $comparemethod ) {
|
261 |
// @todo - prepare - not urgent, there is no way to exploit this query
|
262 |
+
$thisquery = "SELECT a.ID, a.post_title, a.post_type, a.post_status, save_this_post_id\n\t\t\t\t\tFROM {$table_name} AS a\n\t\t\t\t\tINNER JOIN (\n\t\t\t\t\tSELECT post_title, " . $minmax . " AS save_this_post_id\n\t\t\t\t\tFROM {$table_name}\n\t\t\t\t\tWHERE post_type IN(" . $ddp_pts . ")\n\t\t\t\t\tAND post_status IN(" . $post_stati . ")\n\t\t\t\t\tGROUP BY post_title\n\t\t\t\t\tHAVING COUNT( * ) > 1\n\t\t\t\t\t) AS b ON b.post_title = a.post_title\n\t\t\t\t\tAND b.save_this_post_id <> a.id\n\t\t\t\t\tAND a.post_type IN(" . $ddp_pts . ")\n\t\t\t\t\tAND a.post_status IN(" . $post_stati . ")";
|
263 |
$dupes = $wpdb->get_results( $thisquery, ARRAY_A );
|
264 |
|
265 |
if ( $dupes ) {
|
275 |
'orgID' => $dupe['save_this_post_id'],
|
276 |
'orgtitle' => get_the_title( $dupe['save_this_post_id'] ),
|
277 |
'orgpermalink' => get_permalink( $dupe['save_this_post_id'] ),
|
278 |
+
'status' => $dupe['post_status'],
|
279 |
'why' => '',
|
280 |
);
|
281 |
$json_response['dupes'][] = $dupedetails;
|
328 |
'ddp_pts' => array(),
|
329 |
'ddp_statusmail_recipient' => '',
|
330 |
'ddp_enabled' => 0,
|
331 |
+
'ddp_pstati' => array( 'publish' ),
|
332 |
);
|
333 |
return $defaults;
|
334 |
}
|
645 |
|
646 |
public static function admin_options_page()
|
647 |
{
|
648 |
+
global $ddp_fs ;
|
649 |
// DELETE NOW
|
650 |
if ( isset( $_POST['deleteduplicateposts_delete'] ) && isset( $_POST['_wpnonce'] ) ) {
|
651 |
|
697 |
if ( isset( $_POST['ddp_method'] ) ) {
|
698 |
$this->options['ddp_method'] = sanitize_text_field( $_POST['ddp_method'] );
|
699 |
}
|
|
|
700 |
$this->options['ddp_pts'] = $posttypes;
|
701 |
// Previously sanitized
|
702 |
if ( isset( $_POST['ddp_limit'] ) ) {
|
901 |
<p class="description">Choose which post types to scan for duplicates.</p>
|
902 |
</td>
|
903 |
</tr>
|
904 |
+
|
905 |
+
<tr>
|
906 |
+
<th><label for="ddp_enabled"><?php
|
907 |
+
esc_html_e( 'Post status', 'delete-duplicate-posts' );
|
908 |
+
?></label></th>
|
909 |
+
<td>
|
910 |
+
<?php
|
911 |
+
$stati = array(
|
912 |
+
'publish' => (object) array(
|
913 |
+
'label' => 'Published',
|
914 |
+
'show_in_admin_status_list' => true,
|
915 |
+
),
|
916 |
+
);
|
917 |
+
$checked_post_stati = $options['ddp_pstati'];
|
918 |
+
|
919 |
+
if ( $stati ) {
|
920 |
+
?>
|
921 |
+
<ul class="radio">
|
922 |
+
<?php
|
923 |
+
foreach ( $stati as $key => $st ) {
|
924 |
+
|
925 |
+
if ( $st->show_in_admin_status_list ) {
|
926 |
+
$checked = array_search( $key, $checked_post_stati, true );
|
927 |
+
?>
|
928 |
+
<li>
|
929 |
+
<input type="checkbox" name="ddp_pstati[]" id="ddp_pstatus-<?php
|
930 |
+
echo esc_attr( $key ) ;
|
931 |
+
?>" value="<?php
|
932 |
+
echo esc_attr( $key ) ;
|
933 |
+
?>"
|
934 |
+
<?php
|
935 |
+
if ( false !== $checked ) {
|
936 |
+
echo ' checked' ;
|
937 |
+
}
|
938 |
+
?>
|
939 |
+
/>
|
940 |
+
<label for="ddp_pstatus-<?php
|
941 |
+
echo esc_attr( $key ) ;
|
942 |
+
?>"><?php
|
943 |
+
echo esc_html( $key . ' (' . $st->label . ')' ) ;
|
944 |
+
?></label>
|
945 |
+
</li>
|
946 |
+
<?php
|
947 |
+
$step++;
|
948 |
+
}
|
949 |
+
|
950 |
+
}
|
951 |
+
?>
|
952 |
+
</ul>
|
953 |
+
<?php
|
954 |
+
}
|
955 |
+
|
956 |
+
?>
|
957 |
+
</td>
|
958 |
+
|
959 |
+
|
960 |
+
</tr>
|
961 |
+
<?php
|
962 |
$comparemethod = 'titlecompare';
|
963 |
global $ddp_fs ;
|
964 |
?>
|
965 |
+
<tr valign="top">
|
966 |
+
<th><?php
|
967 |
esc_html_e( 'Comparison Method', 'delete-duplicate-posts' );
|
968 |
?></th>
|
969 |
+
<td>
|
970 |
+
<ul class="ddpcomparemethod">
|
971 |
|
972 |
+
<li>
|
973 |
+
<label>
|
974 |
+
<input type="radio" name="ddp_method" value="titlecompare" <?php
|
975 |
checked( 'titlecompare', $comparemethod );
|
976 |
?> /> Compare by title (default)
|
977 |
+
<span class="optiondesc">Looks at the title.</span>
|
978 |
+
</label>
|
979 |
|
980 |
+
</li>
|
981 |
|
982 |
+
<?php
|
983 |
global $ddp_fs ;
|
984 |
?>
|
985 |
+
</ul>
|
986 |
+
</td>
|
987 |
+
</tr>
|
988 |
+
<tr>
|
989 |
+
<th><label for="ddp_keep"><?php
|
990 |
esc_html_e( 'Delete which posts?:', 'delete-duplicate-posts' );
|
991 |
?></label></th><td>
|
992 |
|
993 |
+
<select name="ddp_keep" id="ddp_keep">
|
994 |
+
<option value="oldest"
|
995 |
+
<?php
|
996 |
if ( 'oldest' === $options['ddp_keep'] ) {
|
997 |
echo 'selected="selected"' ;
|
998 |
}
|
999 |
?>
|
1000 |
+
><?php
|
1001 |
esc_html_e( 'Keep oldest', 'delete-duplicate-posts' );
|
1002 |
?></option>
|
1003 |
+
<option value="latest"
|
1004 |
+
<?php
|
1005 |
if ( 'latest' === $options['ddp_keep'] ) {
|
1006 |
echo 'selected="selected"' ;
|
1007 |
}
|
1008 |
?>
|
1009 |
+
><?php
|
1010 |
esc_html_e( 'Keep latest', 'delete-duplicate-posts' );
|
1011 |
?></option>
|
1012 |
+
</select>
|
1013 |
+
<p class="description"><?php
|
1014 |
esc_html_e( 'Keep the oldest or the latest version of duplicates? Default is keeping the oldest, and deleting any subsequent duplicate posts', 'delete-duplicate-posts' );
|
1015 |
?></p>
|
1016 |
+
</td>
|
1017 |
+
</tr>
|
1018 |
|
1019 |
|
1020 |
+
<?php
|
1021 |
/*
|
1022 |
|
1023 |
<tr valign="top">
|
1040 |
*/
|
1041 |
?>
|
1042 |
|
1043 |
+
<tr>
|
1044 |
+
<td colspan="2"><hr></td>
|
1045 |
+
</tr>
|
1046 |
|
1047 |
|
1048 |
|
1049 |
+
<tr valign="top">
|
1050 |
+
<th><?php
|
1051 |
esc_html_e( 'Enable automatic deletion?:', 'delete-duplicate-posts' );
|
1052 |
?>
|
1053 |
|
1054 |
+
</th>
|
1055 |
+
<td><label for="ddp_enabled">
|
1056 |
+
<input type="checkbox" id="ddp_enabled" name="ddp_enabled"
|
1057 |
+
<?php
|
1058 |
if ( true === $options['ddp_enabled'] ) {
|
1059 |
echo 'checked="checked"' ;
|
1060 |
}
|
1061 |
?>
|
1062 |
+
>
|
1063 |
+
<p class="description"><?php
|
1064 |
esc_html_e( 'Clean duplicates automatically.', 'delete-duplicate-posts' );
|
1065 |
?></p>
|
1066 |
+
</label>
|
1067 |
+
</td>
|
1068 |
+
</tr>
|
1069 |
|
1070 |
|
1071 |
+
<tr>
|
1072 |
+
<th><label for="ddp_schedule"><?php
|
1073 |
esc_html_e( 'How often?:', 'delete-duplicate-posts' );
|
1074 |
?></label></th><td>
|
1075 |
|
1076 |
+
<select name="ddp_schedule" id="ddp_schedule">
|
1077 |
+
<?php
|
1078 |
$schedules = wp_get_schedules();
|
1079 |
if ( $schedules ) {
|
1080 |
foreach ( $schedules as $key => $sch ) {
|
1081 |
?>
|
1082 |
+
<option value="<?php
|
1083 |
echo esc_attr( $key ) ;
|
1084 |
?>"
|
1085 |
+
<?php
|
1086 |
if ( esc_attr( $key ) === $options['ddp_schedule'] ) {
|
1087 |
echo esc_html( 'selected="selected"' ) ;
|
1088 |
}
|
1089 |
?>
|
1090 |
+
><?php
|
1091 |
echo esc_html( $sch['display'] ) ;
|
1092 |
?></option>
|
1093 |
+
<?php
|
1094 |
}
|
1095 |
}
|
1096 |
?>
|
1097 |
+
</select>
|
1098 |
+
<p class="description"><?php
|
1099 |
esc_html_e( 'How often should the cron job run?', 'delete-duplicate-posts' );
|
1100 |
?></p>
|
1101 |
+
</td>
|
1102 |
+
</tr>
|
1103 |
|
1104 |
|
1105 |
|
1106 |
+
<tr>
|
1107 |
+
<td colspan="2"><hr></td>
|
1108 |
+
</tr>
|
1109 |
|
1110 |
+
<tr>
|
1111 |
+
<th><?php
|
1112 |
esc_html_e( 'Send status mail?:', 'delete-duplicate-posts' );
|
1113 |
?></th>
|
1114 |
+
<td>
|
1115 |
+
<label for="ddp_statusmail">
|
1116 |
+
<input type="checkbox" id="ddp_statusmail" name="ddp_statusmail"
|
1117 |
+
<?php
|
1118 |
if ( true === $options['ddp_statusmail'] ) {
|
1119 |
echo 'checked="checked"' ;
|
1120 |
}
|
1121 |
?>
|
1122 |
+
<p class="description"><?php
|
1123 |
esc_html_e( 'Sends a status email if duplicates have been found.', 'delete-duplicate-posts' );
|
1124 |
?></p>
|
1125 |
+
</label>
|
1126 |
+
</td>
|
1127 |
+
</tr>
|
1128 |
|
1129 |
+
<tr>
|
1130 |
+
<th><?php
|
1131 |
esc_html_e( 'Email recipient:', 'delete-duplicate-posts' );
|
1132 |
?></th>
|
1133 |
+
<td>
|
1134 |
+
<label for="ddp_statusmail_recipient">
|
1135 |
|
1136 |
+
<input type="text" class="regular-text" id="ddp_statusmail_recipient" name="ddp_statusmail_recipient" value="<?php
|
1137 |
echo esc_html( $options['ddp_statusmail_recipient'] ) ;
|
1138 |
?>">
|
1139 |
+
<p class="description"><?php
|
1140 |
esc_html_e( 'Who should get the notification email.', 'delete-duplicate-posts' );
|
1141 |
?></p>
|
1142 |
+
</label>
|
1143 |
+
</td>
|
1144 |
+
</tr>
|
1145 |
|
1146 |
|
1147 |
|
1148 |
|
1149 |
+
<th colspan=2><input type="submit" class="button-primary" name="delete_duplicate_posts_save" value="<?php
|
1150 |
esc_html_e( 'Save Settings', 'delete-duplicate-posts' );
|
1151 |
?>" /></th>
|
1152 |
+
</tr>
|
1153 |
|
1154 |
+
</table>
|
1155 |
|
1156 |
+
</form>
|
1157 |
+
</div><!-- #configuration -->
|
1158 |
|
1159 |
|
1160 |
+
<div id="log">
|
1161 |
|
1162 |
+
<h3><?php
|
1163 |
esc_html_e( 'The Log', 'delete-duplicate-posts' );
|
1164 |
?></h3>
|
1165 |
+
<div class="spinner is-active"></div>
|
1166 |
+
<ul class="large-text" name="ddp_log" id="ddp_log">
|
1167 |
+
</ul>
|
1168 |
|
1169 |
+
</div>
|
1170 |
+
<p>
|
1171 |
+
<form method="post" id="ddp_clearlog">
|
1172 |
+
<?php
|
1173 |
wp_nonce_field( 'ddp_clearlog_nonce' );
|
1174 |
?>
|
1175 |
|
1176 |
+
<input class="button-secondary" type="submit" name="ddp_clearlog" value="<?php
|
1177 |
esc_html_e( 'Reset log', 'delete-duplicate-posts' );
|
1178 |
?>" />
|
1179 |
+
</form>
|
1180 |
+
</p>
|
1181 |
|
1182 |
+
</div><!-- #ddp_container -->
|
1183 |
|
1184 |
+
<?php
|
1185 |
include_once 'sidebar.php';
|
1186 |
?>
|
1187 |
|
1188 |
+
<?php
|
1189 |
|
1190 |
if ( function_exists( 'ddp_fs' ) ) {
|
1191 |
global $ddp_fs ;
|
1221 |
|
1222 |
|
1223 |
</div>
|
1224 |
+
<?php
|
1225 |
}
|
1226 |
|
1227 |
}
|
js/delete-duplicate-posts.js
CHANGED
@@ -38,9 +38,9 @@ jQuery(document).on('click', '#deleteduplicateposts_deleteall', function(e) {
|
|
38 |
|
39 |
e.preventDefault();
|
40 |
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
|
45 |
jQuery.ajax({
|
46 |
type: 'POST',
|
@@ -103,7 +103,7 @@ function ddp_get_duplicates( stepid, data, self ) {
|
|
103 |
jQuery('#ddp_container #dashboard .statusdiv .dupelist .duplicatetable').show();
|
104 |
|
105 |
jQuery.each( dupes, function( key, value ) {
|
106 |
-
jQuery('#ddp_container #dashboard .statusdiv .dupelist .duplicatetable tbody').append('<tr><td><a href="'+value.permalink+'" target="_blank">'+value.title+'</a> (ID #'+value.ID+' '+value.type+')</td><td><a href="'+value.orgpermalink+'" target="_blank">'+value.orgtitle+'</a> (ID #'+value.orgID+')'+value.why+'</td></tr>');
|
107 |
|
108 |
});
|
109 |
|
38 |
|
39 |
e.preventDefault();
|
40 |
|
41 |
+
if (!confirm('Are you sure you want to delete duplicates? There is no undo feature.')) {
|
42 |
+
return;
|
43 |
+
}
|
44 |
|
45 |
jQuery.ajax({
|
46 |
type: 'POST',
|
103 |
jQuery('#ddp_container #dashboard .statusdiv .dupelist .duplicatetable').show();
|
104 |
|
105 |
jQuery.each( dupes, function( key, value ) {
|
106 |
+
jQuery('#ddp_container #dashboard .statusdiv .dupelist .duplicatetable tbody').append('<tr><td><a href="'+value.permalink+'" target="_blank">'+value.title+'</a> (ID #'+value.ID+' type:'+value.type+' status:'+value.status+')</td><td><a href="'+value.orgpermalink+'" target="_blank">'+value.orgtitle+'</a> (ID #'+value.orgID+')'+value.why+'</td></tr>');
|
107 |
|
108 |
});
|
109 |
|
readme.txt
CHANGED
@@ -4,14 +4,14 @@ Tags: delete duplicate posts, delete duplicate,
|
|
4 |
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
|
8 |
-
Stable tag: 4.
|
9 |
Requires PHP: 5.6
|
10 |
|
11 |
Get rid of duplicate posts and pages on your blog!
|
12 |
|
13 |
== Description ==
|
14 |
-
This plugin searches and removes duplicate posts and their meta data. You can change in the settings how many at a time and if the plugin should run automatically
|
15 |
|
16 |
You can delete posts, pages and other Custom Post Types enabled on your website.
|
17 |
|
@@ -31,7 +31,9 @@ Read more on the [plugin page on cleverplugins.com](https://cleverplugins.com/de
|
|
31 |
Yes! You should always take a backup before deleting posts or pages on your website.
|
32 |
|
33 |
= What happens if it deletes something I do not want to delete? =
|
34 |
-
You should restore the backup you took
|
|
|
|
|
35 |
|
36 |
== Screenshots ==
|
37 |
1. Duplicate posts were found
|
@@ -39,6 +41,13 @@ You should restore the backup you took off your website before you ran this tool
|
|
39 |
|
40 |
== Changelog ==
|
41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
= 4.3 =
|
43 |
* 2020/04/25
|
44 |
* Rewrote plugin to better handle big sites with lots of duplicate content.
|
4 |
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
|
9 |
Requires PHP: 5.6
|
10 |
|
11 |
Get rid of duplicate posts and pages on your blog!
|
12 |
|
13 |
== Description ==
|
14 |
+
This plugin searches and removes duplicate posts and their meta data. You can change in the settings how many at a time and if the plugin should run automatically.
|
15 |
|
16 |
You can delete posts, pages and other Custom Post Types enabled on your website.
|
17 |
|
31 |
Yes! You should always take a backup before deleting posts or pages on your website.
|
32 |
|
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
|
41 |
|
42 |
== Changelog ==
|
43 |
|
44 |
+
= 4.4 =
|
45 |
+
* 2020/05/02
|
46 |
+
* Tested up to WP 5.4.1
|
47 |
+
* Pro: Choose different post stati to look for; publish, draft, scheduled, pending, private and any other custom post status.
|
48 |
+
* Code improvement, works faster.
|
49 |
+
* 218,123 downloads
|
50 |
+
|
51 |
= 4.3 =
|
52 |
* 2020/04/25
|
53 |
* Rewrote plugin to better handle big sites with lots of duplicate content.
|
sidebar.php
CHANGED
@@ -26,14 +26,15 @@ $ddp_deleted_duplicates = get_option( 'ddp_deleted_duplicates' );
|
|
26 |
if ( $ddp_deleted_duplicates ) {
|
27 |
?>
|
28 |
<div class="sidebarrow">
|
29 |
-
<h3>
|
30 |
-
|
31 |
printf(
|
32 |
-
/* translators: %s:
|
33 |
-
__( '%s duplicates
|
34 |
number_format_i18n( $ddp_deleted_duplicates )
|
35 |
);
|
36 |
?>
|
|
|
37 |
</div>
|
38 |
|
39 |
|
@@ -55,7 +56,8 @@ if ( $display_promotion ) {
|
|
55 |
<div class="sidebarrow">
|
56 |
<h3><span class="dashicons dashicons-star-filled"></span> DDP Pro <span class="dashicons dashicons-star-filled"></span></h3>
|
57 |
<ul class="linklist">
|
58 |
-
<li>New compare method - Compare by meta tag <span>Use with WooCommerce (compare SKU) or other plugins</span></li>
|
|
|
59 |
<?php
|
60 |
/*
|
61 |
<li>301 Redirect deleted posts <span>Make sure traffic is directed to the right place</span></li>
|
@@ -69,7 +71,15 @@ if ( $display_promotion ) {
|
|
69 |
?>" class="button button-primary"><?php
|
70 |
echo 'Click here' ;
|
71 |
?></a>
|
72 |
-
<p><center><em>$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
</div><!-- .sidebarrow -->
|
74 |
<?php
|
75 |
}
|
26 |
if ( $ddp_deleted_duplicates ) {
|
27 |
?>
|
28 |
<div class="sidebarrow">
|
29 |
+
<h3>
|
30 |
+
<?php
|
31 |
printf(
|
32 |
+
/* translators: %s: Number of deleted posts */
|
33 |
+
__( '%s duplicates deleted!', 'delete-duplicate-posts' ),
|
34 |
number_format_i18n( $ddp_deleted_duplicates )
|
35 |
);
|
36 |
?>
|
37 |
+
</h3>
|
38 |
</div>
|
39 |
|
40 |
|
56 |
<div class="sidebarrow">
|
57 |
<h3><span class="dashicons dashicons-star-filled"></span> DDP Pro <span class="dashicons dashicons-star-filled"></span></h3>
|
58 |
<ul class="linklist">
|
59 |
+
<li><strong>New compare method</strong> - Compare by meta tag <span>Use with WooCommerce (compare SKU) or other plugins</span></li>
|
60 |
+
<li><strong>Choose post status</strong> - Look for duplicates in scheduled posts, drafts or any other available post status on your site.</li>
|
61 |
<?php
|
62 |
/*
|
63 |
<li>301 Redirect deleted posts <span>Make sure traffic is directed to the right place</span></li>
|
71 |
?>" class="button button-primary"><?php
|
72 |
echo 'Click here' ;
|
73 |
?></a>
|
74 |
+
<p><center><em>$14.99/year - discount for more sites</em></center></p>
|
75 |
+
<p>7-day free trial available!</p>
|
76 |
+
<ul>
|
77 |
+
<li>We ask for your payment information to reduce fraud and provide a seamless subscription experience.</li>
|
78 |
+
<li>CANCEL ANYTIME before the trial ends to avoid being charged.</li>
|
79 |
+
<li>We will send you an email reminder BEFORE your trial ends.</li>
|
80 |
+
<li>We accept Visa, Mastercard, American Express and PayPal.</li>
|
81 |
+
<li>Upgrade, downgrade or cancel any time.</li>
|
82 |
+
</ul>
|
83 |
</div><!-- .sidebarrow -->
|
84 |
<?php
|
85 |
}
|