Developer guide
How the plugins are built, what they store, and how to extend them.
Architecture
- Free: namespace
Siteryn_AI_Review_Intelligence, text domainsiteryn-ai-review-intelligence, settings page slugsiteryn-ai-review-intelligenceunder the sharedsiteryn-pluginsmenu. Admin screens needmanage_woocommerce. - Pro: namespace
Siteryn_AI_Review_Intelligence_Pro. It boots onsiteryn_ai_review_intelligence_loaded, adds its tabs and fields through the Free settings filters, and runs its features only while the license is active. - AI requests go through a provider registry (
siteryn_ai_review_intelligence_providers). Free registers WordPress AI (wp_ai_client_prompt(), WordPress 7.0+); Pro adds HTTP providers. - Insights are generated only from wp-admin AJAX, bulk jobs or the refresh cron. The storefront only reads stored data.
PHP functions
// Published (default) or draft insight, or null.
$insight = siteryn_ai_review_intelligence_get_insights( $product_id, 'published' );
if ( $insight ) {
echo esc_html( $insight->get_summary() );
$sentiment = $insight->get_sentiment(); // [ 'positive' => 80, 'neutral' => 15, 'negative' => 5 ]
}
// The storefront summary HTML ('' when nothing would show).
echo siteryn_ai_review_intelligence_get_summary_html( $product_id, array( 'sections' => array( 'summary', 'highlights' ) ) );
The Insight object (Siteryn_AI_Review_Intelligence\Insights\Insight) also has get_keywords() (term, sentiment), get_highlights() (quote, sentiment, review_id), get_sentiment_label() (positive, mixed, negative), get_review_count(), get_generated_at(), get_published_at(), is_edited(), get_provider(), get_model() and get_extensions( $key ). Pro stores its analysis under the pro extension.
Data stored
| Where | Name | Contents |
|---|---|---|
| Option | siteryn_ai_review_intelligence_settings | Free settings |
| Option | siteryn_ai_review_intelligence_credentials, _credential_hosts | Encrypted API keys per provider; custom endpoint host binding |
| Option | siteryn_ai_review_intelligence_connection, _ai_connections, _ai_models_generation | Last connection test, status per provider, model-list cache version |
| Option | siteryn_ai_review_intelligence_usage, _cache_generation, _version | Daily usage (30 days), response-cache version, installed version |
| Post meta | _siteryn_airi_insights, _siteryn_airi_insights_draft | Published and draft insight per product |
| Post meta | _siteryn_airi_reviews_changed | Time the product's reviews last changed |
| Transients | siteryn_airi_rc_*, siteryn_airi_models_*, siteryn_airi_uh_* | Cached responses, model lists, hourly per-user counts |
| Pro option | siteryn_ai_review_intelligence_pro_settings | Pro settings |
| Pro option | siteryn_ai_review_intelligence_pro_job, _pro_store_voice, _pro_trend_marker, _pro_version | Current bulk job, whole-store customer voice, trend cache marker, installed version |
| Pro term meta | _siteryn_airi_pro_voice | Customer voice per product category |
| Pro comment meta | _siteryn_airi_pro_reply_draft, _siteryn_airi_pro_reply_id | Suggested reply draft and the posted reply's ID |
| Pro transients | siteryn_airi_pro_trend_* | Trend results (12 hours) |
The insight meta is set to "ignore" in wpml-config.xml, so each translation keeps its own insights. Uninstalling either plugin deletes its data.
Templates
| Template | Override in theme |
|---|---|
templates/review-summary.php | yourtheme/siteryn-ai-review-intelligence/review-summary.php (version-checked) |
templates/prompts/review-insights.php | Prompt task and JSON shape; change with the prompt filters |
Pro templates/pro-insights.php | Aspects and praise/complaints block; path filter siteryn_ai_review_intelligence_pro_template_path |
Pro templates/prompts/ advanced-analysis, reply, comparison, customer-voice | Pro prompt templates |
The template receives $args: product, insight, stats, sections, highlights (live-verified), show_ai_label, context (auto, block or shortcode) and heading_id.
AJAX and admin-post endpoints
| Action | Use |
|---|---|
siteryn_ai_review_intelligence_generate · _publish · _discard · _unpublish | Insight workflow (nonce siteryn_ai_review_intelligence_insights; manage_woocommerce and edit the product) |
siteryn_ai_review_intelligence_ai_connector | AI Connector: do = save_key, remove_key, models, test |
siteryn_ai_review_intelligence_save_settings | Save a settings tab |
siteryn_ai_review_intelligence_reset_settings (admin-post) | Reset a tab; Pro siteryn_ai_review_intelligence_pro_reset_settings |
Pro siteryn_ai_review_intelligence_pro_reply_suggest · _reply_approve · _reply_discard | Suggested replies (also needs moderate_comments) |
Pro siteryn_ai_review_intelligence_pro_compare · _voice | AI comparison and customer voice |
Pro siteryn_ai_review_intelligence_pro_bulk_start · _bulk_control · _bulk_status | Bulk jobs |
Pro siteryn_ai_review_intelligence_pro_license_action | License activate, deactivate, refresh |
Pro siteryn_ai_review_intelligence_pro_export_reviews · _export_insights (admin-post) | CSV downloads |
Scheduled tasks (Pro)
| Hook | Runs |
|---|---|
siteryn_ai_review_intelligence_pro_run_job | One product of a bulk or refresh job per run; Action Scheduler group siteryn-ai-review-intelligence-pro when available, otherwise WP-Cron |
siteryn_ai_review_intelligence_pro_refresh | Daily or weekly, while Refresh Out-of-Date Insights is on |
siteryn_ai_review_intelligence_pro_license_check | Daily license check |
JavaScript events
Pro dispatches siteryn_airi_pro_license_changed on document after a license action, with event.detail.active (boolean).
document.addEventListener( 'siteryn_airi_pro_license_changed', function ( e ) {
console.log( 'Pro active:', e.detail.active );
} );
The storefront summary needs no JavaScript; its stylesheet handle is siteryn-ai-review-intelligence (Pro: siteryn-ai-review-intelligence-pro).
See the Hooks reference for every action and filter.