Black Friday: 79% off every plugin Shop the sale →

Hooks & Filters

Prefix: afq_. The plugin is designed to be extended in place; the table lists the stable extension points.

Filters#

FilterArgumentsPurpose
afq_rulesarray $rulesAdd, remove or replace detection rules (objects implementing AFQ_Rule)
afq_ambiguous_link_phrasesarray $phrasesLink texts treated as ambiguous
afq_theme_prints_title_h1bool $default, object $contextWhether the theme prints the post title as an h1 (affects the heading checks)
afq_review_rolesarray $rolesRoles granted the review capability
afq_approval_review_capstring $capThe capability name used to review fixes
afq_ai_availablebool $availableWhether a text-generation provider counts as available
afq_core_alt_text_abilitystring $nameName of the core alt-text ability to use (default ai/alt-text-generation)
afq_change_targetsarray $targetsMap of target type to a change target object
afq_admin_screensarray $screensAdmin screens: page slug to render callable
afq_storeengine_store_urlstring $urlStoreEngine store URL
afq_storeengine_product_idint $idStoreEngine product ID

Actions#

ActionArgumentsPurpose
afq_change_status_changedint $change_id, string $from, string $toRuns on every change status transition (pending, approved, applied, rolled_back, rejected, stale, failed)
afq_before_target_writeAFQ_Change $changeJust before an approved change is written
afq_after_target_writeAFQ_Change $change, true or WP_Error $resultAfter the write and verification

The plugin also exposes lower-level filters used by its own approval module (afq_apply_operations, afq_rollback_operations, afq_change_still_applies, afq_ai_pre_generate). They are for replacing the approval engine or for tests and may change between releases.

Examples#

Let editors review fixes and treat extra phrases as ambiguous:

add_filter( 'afq_review_roles', function ( $roles ) {
	$roles[] = 'editor';
	return $roles;
} );

add_filter( 'afq_ambiguous_link_phrases', function ( $phrases ) {
	return array_merge( $phrases, array( 'details', 'click' ) );
} );

Log every applied change to your own system:

add_action( 'afq_change_status_changed', function ( $change_id, $from, $to ) {
	if ( 'applied' === $to ) {
		error_log( sprintf( 'AFQ change %d applied', $change_id ) );
	}
}, 10, 3 );
Was this article helpful?