-
Notifications
You must be signed in to change notification settings - Fork 214
Hooks and filters
Gary Jones edited this page Apr 24, 2026
·
1 revision
Co-Authors Plus exposes a number of filters and actions so that themes, integrations and other plugins can change its behaviour without patching it. This page documents every extension point in the plugin's production code, grouped by the area of the plugin they affect.
Each entry gives the hook name, the values it receives, the default value (for filters), and a short note on what it's useful for. For the exact firing location, follow the file:line reference.
| Filter | Default | Args | Purpose |
|---|---|---|---|
coauthors_guest_authors_enabled |
true |
$enabled |
Master toggle for the guest-author feature. Return false to disable the guest-author post type and its UI entirely. |
coauthors_guest_authors_force |
false |
$force |
When true, every WP user with a post gets an auto-generated guest author profile. Rarely useful outside import workflows. |
coauthors_plus_support_blocks |
true |
$support |
Return false to stop the plugin registering its block-editor blocks. |
coauthors_auto_apply_template_tags |
false |
$apply |
When true, CAP automatically replaces core's the_author* template functions with its multi-author equivalents. Off by default because it risks surprising theme authors. |
| Filter | Default | Args | Purpose |
|---|---|---|---|
coauthors_guest_author_fields |
(built-in set) | array $fields, array $groups |
The definitive list of profile fields shown on the Edit Guest Author screen. Add, remove or reorder fields here. The $groups argument lets you restrict to a subset (e.g. array( 'name', 'slug' )). |
coauthors_name_field_type_<key> |
'text' |
string $type |
Override the input type for a specific guest-author field. Dynamic — <key> is the field slug. |
coauthors_guest_author_parent_page |
'users.php' |
$parent |
Admin menu parent under which Guest Authors appears. |
coauthors_guest_author_manage_cap |
'list_users' |
$cap |
Capability required to view and manage guest authors. See Roles and capabilities. |
coauthors_show_create_profile_user_link |
false |
$show |
Show a "Create Profile" row-action on the WP user list that spins up a mapped guest author from the user. |
coauthors_guest_author_personal_export_extra_data |
array() |
array $data, int $author_id, string $email |
Extend the data returned to the WordPress personal-data export tool with guest-author records. |
| Filter | Default | Args | Purpose |
|---|---|---|---|
get_coauthors |
(terms-derived list) | array $coauthors, int $post_id |
The canonical list of coauthors for a post. Fires inside get_coauthors(); most sites should leave this alone. |
coauthors_plus_should_query_post_author |
true |
$should |
Return false to stop CAP querying the legacy post_author column as a fallback source of byline data. Big performance win on sites where every post has author terms (see Backfilling coauthor terms for legacy posts). |
coauthors_supported_post_types |
(post types with author support) |
array $post_types |
The list of post types that CAP attaches its taxonomy, UI and REST hooks to. |
coauthors_post_list_pluck_field |
'user_login' |
$field |
Field used to deduplicate existing coauthors when adding new ones to a post. |
coauthors_post_get_coauthor_by_field |
$query_type |
string $field, string $author_name |
Allows overriding the lookup field used by get_coauthors() when resolving names. |
coauthors_edit_ignored_authors |
(current coauthors) | array $ignored |
Authors to exclude from the admin author-search autocomplete. Useful for hiding system accounts. |
| Filter | Default | Args | Purpose |
|---|---|---|---|
coauthors_plus_edit_authors |
(derived from user caps) | bool $can |
Final say on whether the current user can assign coauthors to posts. See Roles and capabilities. |
coauthors_edit_author_cap |
'edit_posts' |
$cap |
Capability required for a WP user to appear in the author-assignment autocomplete. |
coauthors_rest_view_description_cap |
'edit_posts' |
$cap |
Capability required to see author term description values in REST responses. Lower-cap users get an empty string. |
| Filter | Default | Args | Purpose |
|---|---|---|---|
coauthors_meta_box_title |
'Authors' |
$title |
Title of the Authors meta box. Localise or rename freely. |
coauthors_meta_box_context |
'side' |
$context |
Where the meta box appears — 'side', 'normal' or 'advanced'. |
coauthors_meta_box_priority |
'high' |
$priority |
Meta box priority within its context. |
coauthors_default_author |
(current user) | WP_User $author |
Author pre-selected for new posts. |
coauthors_guest_author_sortable_columns |
(built-in set) | array $columns |
Sortable columns on the Guest Authors list table. |
coauthors_guest_author_query_args |
array() |
array $args |
WP_Query args used when fetching the Guest Authors list table. |
coauthors_guest_author_manage_columns |
(built-in set) | array $columns |
Column headers on the Guest Authors list table. Pair with the coauthors_guest_author_custom_columns action to render values. |
coauthors_guest_author_row_actions |
(built-in set) | array $actions, object $item |
Row actions (Edit, Delete, etc.) for each guest author. |
| Filter | Default | Args | Purpose |
|---|---|---|---|
coauthors_default_before |
'' |
$before |
String rendered before the list of coauthors in template-tag output. |
coauthors_default_between |
', ' |
$between |
Separator between coauthors. |
coauthors_default_between_last |
__( ' and ' ) |
$between_last |
Separator before the final coauthor. |
coauthors_default_after |
'' |
$after |
String rendered after the list. |
coauthors_posts_link |
(default link args) | array $args, object $author |
Args used to build a single coauthor's archive link inside coauthors_posts_links(). |
coauthors_wp_list_authors_array |
(resolved list) | array $authors |
The list of authors rendered by coauthors_wp_list_authors(). |
| Filter | Default | Args | Purpose |
|---|---|---|---|
rest_coauthors_item_schema |
(built-in schema) | array $schema |
The schema published for the /coauthors/v1/coauthors/* responses. Adding new top-level properties here will trigger a _doing_it_wrong warning — use it to adjust existing fields, not to extend them. |
rest_prepare_coauthor |
WP_REST_Response |
WP_REST_Response $response, object $author, WP_REST_Request $request |
Final mutation point for coauthor REST responses, analogous to core's rest_prepare_* hooks. |
| Filter | Default | Args | Purpose |
|---|---|---|---|
coauthors_count_published_post_types |
array( 'post' ) |
array $post_types |
Post types included when counting a coauthor's published work (archive counts, count_user_posts() overrides). |
coauthors_open_graph_tags |
(derived tags) | array $tags |
Open Graph meta tags emitted for coauthored posts. |
coauthors_plus_enqueue_block_editor_assets |
(built-in data) | array $data |
The JS data object passed to the block editor (author endpoint URLs, strings, capabilities). |
| Action | Args | Purpose |
|---|---|---|
cap_guest_author_create |
(none) | Fires after a guest author is successfully created via the admin flow. Good hook for sending notifications, seeding profile fields, or logging. |
cap_guest_author_del |
(none) | Fires after a guest author is deleted. |
coauthors_guest_author_custom_columns |
string $column_name, int $author_id |
Fires for each row of the Guest Authors list table after the built-in columns have been rendered. Pair with coauthors_guest_author_manage_columns to register the column and with this action to render its value. |
A few habits that will save you pain:
-
Guard your callbacks. CAP hooks fire during admin, REST, front-end and CLI contexts. A callback that assumes
current_user_can()is safe to call, or that$postis set, may blow up in cron or inwp-cli. Check the context before acting. -
Prefer filters that return
nullor the original value on opt-out over unconditionally returning a value. Sticking areturn trueintocoauthors_plus_should_query_post_authorwithout reading the input is a recipe for a support ticket when the default ever changes. -
Namespace your filter priorities. If you need to run before or after another plugin, pick an obvious non-default priority (e.g.
5or99) and leave a comment explaining why. -
Don't rebuild what CAP already gives you. If you're tempted to call
get_posts( array( 'author' => ... ) )from inside one of these filters, look first atget_coauthors(),is_coauthor_for_post()and the template tags — they already handle the taxonomy and fallback logic correctly.