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

Authors now missing from the Posts list table after 3.6.0 update #1033

Closed justinmaurerdotdev closed 2 months ago

justinmaurerdotdev commented 2 months ago

I've been working on an issue related to Co-Authors Plus with the WP List Table at wp-admin/edit.php?post_status=publish&post_type=post and I just saw there was an update. I went ahead and updated my local environment and noticed that the Authors column is completely missing. Weirdly, the regular Author column is also missing. I seemingly don't have any way to see the author for a post before I click to edit.

~I checked the code that I had previously been working with and noticed it's entirely missing from the updated plugin. Here's a link to the filters I was working with before, that appear to do at least part of the admin column handling: https://github.com/Automattic/Co-Authors-Plus/blob/33ae3b0c8adf54f0ad193caa5fa13f166fcc4ddc/co-authors-plus.php#L265C1-L268C100~

~It's not just the filters missing. The functions are also gone. Was this intentional? Am I missing something?~

Edit: I figured out that PHPStorm's index had not fully updated so the search function hadn't found the new class yet. That said, I am still missing the Author/Authors column in the Posts table and not sure why.

justinmaurerdotdev commented 2 months ago

I was able to determine that, on 3.6.0, all of my post types are failing the is_post_type_enabled() check here: https://github.com/Automattic/Co-Authors-Plus/blob/586e803589a5d3f86de6f04a8391385529b3fbbe/php/class-coauthors-plus.php#L508C1-L508C43.

After rolling back to 3.5.15, the authors column re-appears. My best guess is that there's some way that this remove_post_type_support() call is happening at the wrong time in the refactored plugin or something: https://github.com/Automattic/Co-Authors-Plus/blob/586e803589a5d3f86de6f04a8391385529b3fbbe/php/class-coauthors-plus.php#L496

shelb-elliott commented 2 months ago

Commenting to add that Newspack has received several reports of this from our publishers.

douglas-johnson commented 2 months ago

Seems related to this https://github.com/Automattic/Co-Authors-Plus/pull/1006

and specifically ! post_type_supports( $name, 'author' ) on this line https://github.com/Automattic/Co-Authors-Plus/blob/3.6.0/php/class-coauthors-plus.php#L269

Because remove_quick_edit_authors_box does remove_post_type_support( get_post_type(), $this->coauthor_taxonomy ); as an action on admin_head, subsequent calls to supported_post_types() won't include the current post type.

https://github.com/Automattic/Co-Authors-Plus/blob/3.6.0/php/class-coauthors-plus.php#L496C4-L496C74

justinmaurerdotdev commented 2 months ago

My above PR fixes this. I'm not sure if it's the solution that everyone will want/agree on, but it does fix the issue.

douglas-johnson commented 2 months ago

One idea for consideration:

So in remove_quick_edit_authors_box we could replace this

remove_post_type_support( get_post_type(), $this->coauthor_taxonomy );

with roughly this


add_filter(
  'quick_edit_dropdown_authors_args',
  fn() => [ 'include' => [0] ]
);
GaryJones commented 2 months ago

@justinmaurerdotdev @douglas-johnson Thank you both for diving into this - so very helpful.

I reviewed the (nicely documented) PR from @justinmaurerdotdev, but to keep things simple, I've gone for the more targetted and simpler approach suggested by @douglas-johnson and created #1038. I'd love it if you could both give it a test and see if that seems to be working as intended please.