NewMeet Native Connect WP: your AI builds in Elementor, Bricks and Breakdance.Native Connect WP is here.See how

DocsDevelopers

Hooks and filters

WordPress actions and filters for forms, data sources, dynamic data, Query Loops, analytics, reports, features, the agent and the builder.

Forms#

HookTypeArguments and use
nativeai_register_form_actionsactionRegister form actions with register_form_action().
nativeai_register_form_integrationsactionRegister integrations with register_form_integration().
nativeai_form_submissionfilter$submission — change or check a submission before it’s stored and actions run. Return a WP_Error to reject it with a message.
nativeai_form_submittedaction$submission — submitted, stored (when the form stores submissions) and its immediate actions ran.
nativeai_form_succeededaction$submission — accepted: stored and its immediate actions succeeded.
nativeai_form_failedaction$submission, $message — an action failed; $message is what the visitor was told.
nativeai_form_action_resultaction$result, $action, $submission — after each action runs.
nativeai_forms_allow_private_urlsfilterfalse, $url — let form requests reach private or local addresses.
add_filter( 'nativeai_form_submission', function ( $submission ) {
	// Reject submissions from a blocked domain.
	$email = (string) $submission->value( 'email' );
	if ( str_ends_with( strtolower( $email ), '@example.com' ) ) {
		return new WP_Error( 'blocked', 'Please use your work email.' );
	}
	return $submission;
} );

Data sources#

HookTypeArguments and use
nativeai_data_allow_private_urlsfilterfalse, $url — let data sources call private or local addresses.
nativeai_data_rate_limitfilter$per_minute, $source_id — requests per minute for a source.
nativeai_data_max_bytesfilter$bytes — the largest response accepted.

Dynamic data and Query Loops#

HookTypeArguments and use
nativeai_dynamic_meta_allowedfilter$allowed, $key, $type — expose or hide a custom field in dynamic data.
nativeai_query_argsfilter$args, $spec, $context — adjust the WordPress query arguments of Query Loops.
nativeai_query_post_typesfilter$types — the post types visitors may see in loops (public ones by default).

Analytics#

HookTypeArguments and use
nativeai_analytics_should_trackfiltertrue — return false to not count the current request.
nativeai_analytics_eventfilter$row — change an event before it’s stored; return something that isn’t an array to drop it.
nativeai_analytics_consent_requiredfilterfalse — require consent before counting, like “Wait for consent”.
nativeai_analytics_trackaction$name, $props — record a server-side event in the current visit: do_action( 'nativeai_analytics_track', 'signup', array( 'label' => 'Pro plan', 'value' => 49 ) );
nativeai_analytics_conversionaction$goal, $event — a goal was reached.

Reports and the activity record#

HookTypeArguments and use
nativeai_report_providersactionRegister report sections: Reports\Registry::register( new MyProvider() ).
nativeai_report_error_typesfilter$types — the event types the Errors section groups.
nativeai_report_summary_modelfilter'' — the model that writes report summaries.
nativeai_report_summary_prefilternull, $facts — return a summary to skip the AI call.

Add your own events to the activity record — they appear in reports, the Activity screen and the AI’s answers:

\NativeAI\Platform\Events::record( array(
	'type'        => 'backup.completed',
	'module'      => 'backups',
	'severity'    => 'info',
	'summary'     => 'Backup completed (2.4 GB)',
	'object_type' => 'backup',
	'object_id'   => '42',
) );

For repeated events, pass a fingerprint (Events::fingerprint( $type, … ) ignores IDs and numbers) and merge (seconds) so repeats fold into one line.

Memberships and addresses#

HookTypeArguments and use
nativeai_membership_startedaction$user_id, $plan_id, $source, $membership_id — someone became a member (or a membership became active again).
nativeai_membership_endedaction$user_id, $plan_id, $status — a membership stopped being active: paused, expired or cancelled.
nativeai_restrictedfilterfalse, $post — whether a builder page is kept from the current visitor (Memberships answers it).
nativeai_permalink_changedaction$kind, $id, $old, $new — a post’s or term’s address changed (paths relative to the site).

Automations#

HookTypeArguments and use
nativeai_automation_integrationsfilter$integrations — add apps to Automations: return the list with your own objects extending NativeAI\Automations\Integration (id, name, triggers: the WordPress action each listens to and how to read it; actions: fields and a run callback).
nativeai_automation_log_daysfilter30 — how many days automation runs are kept.
nativeai_security_blockedaction$ip, $reason, $minutes, $block — Security blocked or locked out an address.
nativeai_security_issue_foundaction$issue (kind, severity, object, summary) — the scan found something new.
nativeai_security_new_deviceaction$user_id, $ip, $browser — someone signed in from a new device.
nativeai_security_scan_finishedaction$counts — open issues by severity after a scan.
nativeai_crm_eventaction$trigger, $contact_id, $context — a CRM event (contact added, tag or list changed, status changed).
nativeai_studio_post_writtenaction$post_id, $brief — Content Studio’s AI writer finished a post.
nativeai_mail_failedaction$log_id, $to, $subject, $error — an email couldn’t be sent.
nativeai_consent_recordedaction$action, $categories, $url — a visitor made a cookie choice.
nativeai_popup_eventaction$doc_id, $metric — a popup was seen, opened, closed, clicked or converted.

Features, jobs, notifications and the agent#

HookTypeArguments and use
nativeai_register_featuresactionRegister optional features.
nativeai_feature_availablefiltertrue, $feature_id, $tier — whether a feature can be switched on.
nativeai_feature_toggledaction$feature_id, $on — a feature was switched on or off.
nativeai_agent_capabilitiesactionRegister capabilities the AI agent can use (see the capability reference).
nativeai_job_failedaction$job, $error — a background job ran out of attempts.
nativeai_notification_deliveredaction$notification — send Native WP AI notifications elsewhere (Slack, a webhook).

Builder and rendering#

HookTypeArguments and use
nativeai_editor_head, nativeai_editor_footeractionPrint into the builder’s head and footer.
nativeai_committedaction$result — the builder saved changes.
nativeai_render_elementfilternull, $node, $context — HTML for an element type Native WP AI doesn’t know; return null to render nothing.
A screenshot, full size