run(); } // Execute the startup in the correct hook (this is safer than calling it directly). add_action('plugins_loaded', 'saef_run_plugin'); /** * (ES) Aviso administrativo cuando WooCommerce no está activo. * (EN) Admin notice shown when WooCommerce is not active. */ function saef_admin_notice_woocommerce_required() { echo '
'; echo '

' . esc_html__('Allergen Exclusion Filter requires WooCommerce to be installed and active to function.', 'allergen-exclusion-filter') . '

'; echo '
'; } /** * 4. ACTIVATION MANAGEMENT */ register_activation_hook(__FILE__, 'saef_activate_plugin'); function saef_activate_plugin() { require_once SAEF_PLUGIN_DIR . 'includes/class-saef-taxonomies.php'; $saef_taxonomies = new SAEF_Taxonomies(); $saef_taxonomies->saef_rewrite_flush(); } /** * (ES) Al desactivar el plugin, limpiamos las rewrite rules para evitar 404 residuales. * (EN) On plugin deactivation, flush rewrite rules to avoid residual 404s. */ register_deactivation_hook(__FILE__, 'saef_deactivate_plugin'); function saef_deactivate_plugin() { flush_rewrite_rules(); }