Hooks & Filters
Prefix: afq_. The plugin is designed to be extended in place; the table lists the stable extension points.
Filters#
| Filter | Arguments | Purpose |
|---|---|---|
afq_rules | array $rules | Add, remove or replace detection rules (objects implementing AFQ_Rule) |
afq_ambiguous_link_phrases | array $phrases | Link texts treated as ambiguous |
afq_theme_prints_title_h1 | bool $default, object $context | Whether the theme prints the post title as an h1 (affects the heading checks) |
afq_review_roles | array $roles | Roles granted the review capability |
afq_approval_review_cap | string $cap | The capability name used to review fixes |
afq_ai_available | bool $available | Whether a text-generation provider counts as available |
afq_core_alt_text_ability | string $name | Name of the core alt-text ability to use (default ai/alt-text-generation) |
afq_change_targets | array $targets | Map of target type to a change target object |
afq_admin_screens | array $screens | Admin screens: page slug to render callable |
afq_storeengine_store_url | string $url | StoreEngine store URL |
afq_storeengine_product_id | int $id | StoreEngine product ID |
Actions#
| Action | Arguments | Purpose |
|---|---|---|
afq_change_status_changed | int $change_id, string $from, string $to | Runs on every change status transition (pending, approved, applied, rolled_back, rejected, stale, failed) |
afq_before_target_write | AFQ_Change $change | Just before an approved change is written |
afq_after_target_write | AFQ_Change $change, true or WP_Error $result | After 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?
Tell us what was missing
