Hooks & Filters
Academic References fires action hooks on key lifecycle events and exposes filters for customizing behavior. All hook names are prefixed abt_.
Action hooks
Section titled “Action hooks”| Hook | Arguments | Fires when |
|---|---|---|
abt_reference_created |
$post_id, $data |
A reference is created |
abt_reference_updated |
$post_id, $data |
A reference is updated |
abt_reference_deleted |
$post_id |
A reference is deleted |
abt_reference_imported |
$ref_id, $source |
A reference is imported (per entry) |
abt_import_completed |
$results, $format |
An import run finishes |
abt_export_completed |
$format, $reference_ids |
An export run finishes |
abt_collection_created |
$collection_id |
A collection is created |
abt_collection_updated |
$collection_id, $data |
A collection is updated |
abt_collection_deleted |
$collection_id |
A collection is deleted |
abt_reference_added_to_collection |
$ref_id, $collection_id |
A reference is added to a collection |
abt_before_template_part |
template context | Before a plugin template part renders |
abt_after_template_part |
template context | After a plugin template part renders |
Example:
add_action( 'abt_reference_created', function ( $post_id, $data ) { // React to a new reference.}, 10, 2 );Filters
Section titled “Filters”| Filter | Default | Purpose |
|---|---|---|
abt_supported_post_types |
configured post types | Post types that support citations |
abt_citation_supported_post_types |
enabled post types | Post types that load the editor block assets |
abt_force_load_assets |
false |
Force front-end assets to load on the current request |
abt_load_assets_everywhere |
true |
Load assets site-wide vs. only where needed |
abt_locate_template |
resolved path | Override the resolved template file path |
abt_get_template_part |
template args | Filter template part arguments |
Example - add a custom post type to citation support:
add_filter( 'abt_supported_post_types', function ( $types ) { $types[] = 'my_cpt'; return $types;} );
