Skip to content

Commit

Permalink
Fix missing author column in wp-admin Posts table
Browse files Browse the repository at this point in the history
Fixes #1033.
  • Loading branch information
GaryJones committed Apr 25, 2024
1 parent 586e803 commit 7ed7196
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions php/class-coauthors-plus.php
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ public function admin_init() {
*
* By default, this is the built-in and custom post types that have authors.
*
* @since 3.5.16
* @since 3.6.0
*
* @return array Supported post types.
*/
Expand Down Expand Up @@ -487,13 +487,23 @@ public function refresh_coauthors_nonce( $response ) {
}

/**
* Removes the default 'author' dropdown from quick edit
* Removes the default 'author' dropdown from quick edit.
*/
public function remove_quick_edit_authors_box() {
global $pagenow;

if ( 'edit.php' === $pagenow && $this->is_post_type_enabled() ) {
remove_post_type_support( get_post_type(), $this->coauthor_taxonomy );
/*
* The author dropdown isn't displayed if wp_dropdown_users( $args ) returns an empty string.
* It will return an empty string if the user query returns an empty array.
* We can force it return an empty array by changing $args to include only the user ID 0 which doesn't exist.
* We can target the $args specific to Quick Edit using the filter quick_edit_dropdown_authors_args.
* See https://github.com/Automattic/Co-Authors-Plus/issues/1033.
*/
add_filter(
'quick_edit_dropdown_authors_args',
static fn() => [ 'include' => [ 0 ] ]

Check failure on line 505 in php/class-coauthors-plus.php

View workflow job for this annotation

GitHub Actions / WP 5.7 on PHP 7.1

syntax error, unexpected 'fn' (T_STRING), expecting :: (T_PAAMAYIM_NEKUDOTAYIM)

Check failure on line 505 in php/class-coauthors-plus.php

View workflow job for this annotation

GitHub Actions / WP 6.3 on PHP 7.1

syntax error, unexpected 'fn' (T_STRING), expecting :: (T_PAAMAYIM_NEKUDOTAYIM)
);
}
}

Expand Down

0 comments on commit 7ed7196

Please sign in to comment.