/**
 * AJAX Handler: Trigger Wellness Cron
 */
add_action( 'wp_ajax_drt_trigger_wellness', 'drt_ajax_trigger_wellness' );

function drt_ajax_trigger_wellness() {
    check_ajax_referer( 'drt_admin_action', 'security' );
    
    if ( ! current_user_can( 'manage_options' ) ) {
        wp_send_json_error( array( 'message' => 'Unauthorized access.' ) );
    }

    if ( ! function_exists( 'drt_process_wellness_checks' ) ) {
        $wellness_file = dirname( DRT_ADMIN_DIR ) . '/Wellness/wellness-config.php';
        if ( file_exists( $wellness_file ) ) {
            require_once $wellness_file;
        } else {
            wp_send_json_error( array( 'message' => 'Wellness Engine file not found.' ) );
        }
    } 
    
    // Capture the engine's true diagnostic log
    $diagnostic_log = drt_process_wellness_checks( true );

    wp_send_json_success( array( 
        'message' => 'Wellness check diagnostic run complete!',
        'log'     => $diagnostic_log
    ) );
    wp_die();
}<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="https://gregbmartin.ca/wp-sitemap-index.xsl" ?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><sitemap><loc>https://gregbmartin.ca/wp-sitemap-posts-post-1.xml</loc></sitemap><sitemap><loc>https://gregbmartin.ca/wp-sitemap-posts-page-1.xml</loc></sitemap><sitemap><loc>https://gregbmartin.ca/wp-sitemap-taxonomies-category-1.xml</loc></sitemap></sitemapindex>
