Skip to content

Commit

Permalink
Deletes extra code. Moves a get_option() call inside a condition to o…
Browse files Browse the repository at this point in the history
…nly run it when absolutely needed.
  • Loading branch information
csalzano committed Nov 26, 2024
1 parent 486809d commit 831e63c
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions includes/class-invp.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,16 +128,11 @@ private static function delete_all_inventory_on_blog() {
);
$posts = get_posts( $args );
$deleted_count = 0;
$settings = self::settings();

if ( $posts ) {
$settings = self::settings();
foreach ( $posts as $post ) {
// delete the parent post or vehicle.
if ( $settings['skip_trash'] ) {
wp_delete_post( $post->ID, $settings['skip_trash'] );
} else {
wp_trash_post( $post->ID );
}
wp_delete_post( $post->ID, $settings['skip_trash'] );
++$deleted_count;
}
}
Expand Down

0 comments on commit 831e63c

Please sign in to comment.