-
Notifications
You must be signed in to change notification settings - Fork 206
Home
The Co-Authors Plus plugin makes it easy to assign one or more bylines to a post. Upon activation, you’ll be able to start assigning multiple bylines right away. In order for those bylines to appear on the frontend, you may need to make some small modifications to your theme.
Assign multiple bylines to posts, pages, and custom post types via a search-as-you-type input box. Co-authored posts appear on a co-author's archive page and in their feed. Co-authors may edit the posts they are associated with, and co-authors who are contributors may only edit posts if they have not been published (as is core behavior).
This plugin is an almost complete rewrite of the Co-Authors plugin originally developed by Weston Ruter (2007). The original plugin was inspired by the 'Multiple Authors' plugin by Mark Jaquith (2005).
On the frontend, use the Co-Authors Plus template tags to list co-authors anywhere you'd normally list the author.
If you've just installed Co-Authors Plus, you might notice that the bylines are being added in the backend but aren't appearing on the frontend. You'll need to add the template tags to your theme before the bylines will appear.
Use the coauthors_wp_list_authors()
template tag. This accepts many of the same arguments as wp_list_authors()
. Look in template-tags.php for more details.
Co-Authors Plus can be network-activated on a WordPress multisite, or on a site-by-site basis. If you create guest authors, however, those guest authors will exist on a site-by-site basis.
If the site has a large database, you may run into issues with heavier than usual queries. You can work around this by disabling compat mode and force it to use simpler, tax-only queries by adding the following to your theme:
// Use simple tax queries for CAP to improve performance
add_filter( 'coauthors\_plus\_should\_query\_post\_author', '\_\_return\_false' );
Note: This requires the site(s) to have proper terms set up for all users. You can do this with the following wp-cli command:
# This is pretty long-running and can be expensive; be careful!
$ wp --url=example.com co-authors-plus create-terms-for-posts
To ensure posts with your CPT are counted, use the coauthors_count_published_post_types
filter.
add_filter( 'coauthors\_count\_published\_post\_types', function( $post\_types ) {
$post\_types[] = 'my\_cpt\_slug';
return $post\_types;
} );
To display the metabox on your CPT, either call register_post_type()
with $args['supports']
containing 'author'
, or call add_post_type_support( 'my_cpt_slug', 'author' );