PATH:
var
/
www
/
clients
/
client1
/
web1
/
web
/
wp-content
/
plugins
/
wp-all-import-pro
/
actions
<?php /** * AJAX handler to cleanup orphaned preview posts * This runs as a fallback to clean up preview posts that weren't deleted properly */ function pmxi_wp_ajax_wpai_cleanup_orphaned_previews() { // Security check if (!check_ajax_referer('wp_all_import_secure', 'security', false)) { wp_send_json_error(array('message' => __('Security check failed', 'wp-all-import-pro')), 403); } if (!current_user_can(PMXI_Plugin::$capabilities)) { wp_send_json_error(array('message' => __('Insufficient permissions', 'wp-all-import-pro')), 403); } try { // Find all preview posts older than 1 hour $one_hour_ago = date('Y-m-d H:i:s', strtotime('-1 hour')); $args = array( 'post_type' => 'any', 'post_status' => 'any', 'posts_per_page' => -1, 'meta_query' => array( array( 'key' => '_wpai_preview_post', 'value' => '1', 'compare' => '=' ) ), 'date_query' => array( array( 'before' => $one_hour_ago, 'inclusive' => true, ) ), 'fields' => 'ids' ); $orphaned_posts = get_posts($args); $deleted_count = 0; $failed_count = 0; if (!empty($orphaned_posts)) { foreach ($orphaned_posts as $post_id) { // Force delete (bypass trash) $result = wp_delete_post($post_id, true); if ($result) { $deleted_count++; } else { $failed_count++; } } } wp_send_json_success(array( 'message' => sprintf( __('Cleanup complete: %d orphaned preview posts deleted, %d failed', 'wp-all-import-pro'), $deleted_count, $failed_count ), 'deleted' => $deleted_count, 'failed' => $failed_count, 'total_found' => count($orphaned_posts) )); } catch (Exception $e) { wp_send_json_error(array('message' => $e->getMessage()), 500); } } add_action('wp_ajax_wpai_cleanup_orphaned_previews', 'pmxi_wp_ajax_wpai_cleanup_orphaned_previews');
[-] delete_term.php
[edit]
[-] pmxi_before_xml_import.php
[edit]
[-] wp_ajax_wpai_delete_preview_session.php
[edit]
[-] wp_ajax_test_images.php
[edit]
[-] pmxi_after_xml_import.php
[edit]
[-] attachment_updated.php
[edit]
[-] wp_ajax_get_bundle_post_type.php
[edit]
[-] wp_ajax_wpai_scheduling_subscribe_dialog_content.php
[edit]
[-] wp_ajax_import_failed.php
[edit]
[-] wpai_disable_preview_beforeunload.php
[edit]
[-] wp_ajax_delete_import.php
[edit]
[-] admin_head.php
[edit]
[-] wp_ajax_auto_detect_cf.php
[edit]
[-] wp_ajax_auto_detect_sf.php
[edit]
[-] wp_loaded_99.php
[edit]
[-] wp_ajax_wpai_send_feedback.php
[edit]
[-] wp_ajax_wpai_cleanup_orphaned_previews.php
[edit]
[-] wp_ajax_wpai_scheduling_dialog_content.php
[edit]
[-] delete_post.php
[edit]
[-] wpmu_new_blog.php
[edit]
[-] wp_ajax_wpai_send_to_codebox.php
[edit]
[+]
..
[-] admin_menu.php
[edit]
[-] admin_init.php
[edit]
[-] pmxi_after_xml_import_99.php
[edit]
[-] wp_ajax_upload_resource.php
[edit]
[-] wp_ajax_wpai_load_preview_settings.php
[edit]
[-] wp_ajax_wp_all_import_api.php
[edit]
[-] wp_ajax_wpai_get_scheduling_connection_icon.php
[edit]
[-] wp_ajax_dismiss_notifications.php
[edit]
[-] add_attachment.php
[edit]
[-] wp_ajax_wpai_run_preview_with_progress.php
[edit]
[-] wp_ajax_wpai_delete_preview_posts.php
[edit]
[-] wp_ajax_save_import_scheduling.php
[edit]
[-] admin_notices.php
[edit]
[-] wp_ajax_save_import_functions.php
[edit]
[-] wp_ajax_wpai_dismiss_review_modal.php
[edit]