Co-Authors-Plus icon indicating copy to clipboard operation
Co-Authors-Plus copied to clipboard

Override "Co-Authors" blocks to only render primary author

Open reveritas opened this issue 1 year ago • 1 comments

This isn't really an "issue" so much as it is a question, but I didn't know where else to post this.

I would like to use the "Co-Authors" block to display author information under a post - but not for all co-authors, only for the primary author, i.e. the first one. I don't know which functions I need to hook filters or actions in to change the result from all co-authors to only one. I could directly change the render_block() functions of the blocks or the Blocks::get_authors_with_api_schema() function which gets the author data. But then my changes will be overridden with the next update, so I would like to do it with an external override.

I'm new to WP so if there is an obvious answer for how to find out which functions can be hooked into, please let me know.

reveritas avatar Jun 02 '24 14:06 reveritas

Would either of these make sense?

  • The ability to set a maximum number of authors on the co-authors block in the editor
  • A filter here in the API controller after the authors are found but before the data is prepared for a REST reesponse.
    • https://github.com/Automattic/Co-Authors-Plus/blob/3.6.1/php/api/endpoints/class-coauthors-controller.php#L189

douglas-johnson avatar Jun 10 '24 18:06 douglas-johnson