Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

INVP::delete_all_inventory_on_blog()

Deletes all posts in the vehicle post type.


Return Return

(int)


Top ↑

Source Source

File: includes/class-invp.php

	private static function delete_all_inventory_on_blog() {
		$args          = array(
			'post_status'    => get_post_stati(),
			'post_type'      => self::POST_TYPE,
			'posts_per_page' => apply_filters( 'invp_query_limit', 1000, __METHOD__ ),
		);
		$posts         = get_posts( $args );
		$deleted_count = 0;

		if ( $posts ) {
			$settings = self::settings();
			foreach ( $posts as $post ) {
				wp_delete_post( $post->ID, $settings['skip_trash'] );
				++$deleted_count;
			}
		}

		do_action( 'invp_delete_all_inventory', $deleted_count );

		return $deleted_count;
	}