import duplicates in a deliberate way

Signed-off-by: Chris Abraham <cjyabraham@gmail.com>
This commit is contained in:
Chris Abraham 2024-11-19 14:41:22 -08:00
parent a90908c4bf
commit 1414639ef2
No known key found for this signature in database
GPG Key ID: 60A2BD1DA7D4B0F0
1 changed files with 125 additions and 126 deletions

View File

@ -76,8 +76,8 @@ if ( ! $people ) {
$synced_ids = array();
$i = 1;
foreach ( $people as $p ) {
for ( $i = 0; $i < 3; $i++ ) {
$params = array(
'post_type' => 'lf_person',
'post_title' => $p->name . $i,
@ -201,21 +201,20 @@ foreach ( $people as $p ) {
$synced_ids[] = $newid;
}
}
}
// delete any People posts which aren't in $synced_ids.
$query = new WP_Query(
array(
'post_type' => 'lf_person',
'post__not_in' => $synced_ids,
'posts_per_page' => -1,
)
);
while ( $query->have_posts() ) {
$query->the_post();
wp_delete_post( get_the_id() );
}
// $query = new WP_Query(
// array(
// 'post_type' => 'lf_person',
// 'post__not_in' => $synced_ids,
// 'posts_per_page' => -1,
// )
// );
// while ( $query->have_posts() ) {
// $query->the_post();
// wp_delete_post( get_the_id() );
// }
// clear the site cache.
if ( function_exists( 'pantheon_wp_clear_edge_all' ) ) {