'adv-vis-element', 'numberposts' => -1, 'post_status' => 'any']); if (!empty($ave_shortcodes)) { foreach ($ave_shortcodes as $post) { wp_delete_post($post->ID, true); } } } // if old Elements folder is present, delete it, then wipe the whole folder if it's empty $old_elements_path = WP_CONTENT_DIR . DIRECTORY_SEPARATOR . 'wp-ave-elements'; if (is_dir($old_elements_path)) { $old_elements_folder = list_files($old_elements_path); if (empty($old_elements_folder)) { Adv_Vis_Ele_Helpers::get_wp_filesystem()->rmdir($old_elements_path); } } } }