Automattic / Co-Authors-Plus

Multiple bylines and Guest Authors for WordPress
https://wordpress.org/plugins/co-authors-plus/
GNU General Public License v2.0
287 stars 205 forks source link

Filter author label during selection #978

Open Ritesh-patel opened 11 months ago

Ritesh-patel commented 11 months ago

Description

This PR adds a filter coAuthors.author.label.formatted which allows developers to change author label in the Author's panel in editor. With this new filter, more author data can be shown while selecting the author.

Filter usage:

import { addFilter } from '@wordpress/hooks';

addFilter(
    'coAuthors.author.label.formatted',
    'coauthors/format-author-label',
    (label, author) => {
        return `${ author.displayName } | ${ author.email } | ${ author.userNicename }`;
    },
);

Deploy Notes

Are there any new dependencies added that should be taken into account when deploying to WordPress.org?

Steps to Test

Outline the steps to test and verify the PR here.

  1. Check out PR.
  2. Use the example code as above