add_node([ 'id' => 'ai-scrape-protect-icon', 'title' => '' . esc_attr__('AI Scrape Protect', 'ai-scrape-protect') . '', 'href' => esc_url($settings_url), 'meta' => [ 'class' => $is_active ? 'aisp-active' : 'aisp-inactive', ], ]); } // AJAX endpoint to return current icon state (used by JS after toggle). public function get_icon_state() { if (!current_user_can('manage_options')) { wp_send_json_error([], 403); } $options = get_option('aisp_options', []); $is_active = !empty($options['enabled']); wp_send_json_success(['active' => $is_active]); } }