Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix missing author column in wp-admin Posts table #1038

Merged
merged 1 commit into from
Apr 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
*
* 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 @@
}

/**
* 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
Loading