From c7193781bbeb8644688eb05422f257a48b511b70 Mon Sep 17 00:00:00 2001 From: Matthew Haines-Young Date: Fri, 3 Mar 2023 17:07:02 +0000 Subject: [PATCH] Hide author field in quickedit --- inc/namespace.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/inc/namespace.php b/inc/namespace.php index e3c4b18..27f2b22 100644 --- a/inc/namespace.php +++ b/inc/namespace.php @@ -54,6 +54,7 @@ function bootstrap() : void { add_filter( 'the_author', __NAMESPACE__ . '\\filter_the_author_for_rss' ); add_filter( 'comment_moderation_recipients', __NAMESPACE__ . '\\filter_comment_moderation_recipients', 10, 2 ); add_filter( 'comment_notification_recipients', __NAMESPACE__ . '\\filter_comment_notification_recipients', 10, 2 ); + add_filter( 'quick_edit_dropdown_authors_args', __NAMESPACE__ . '\\hide_quickedit_authors' ); } /** @@ -807,3 +808,18 @@ function filter_comment_notification_recipients( array $emails, int $comment_id return array_unique( array_merge( $emails, $additional_emails ) ); } + +/** + * Hide author select from quick edit. + * + * Bit of a hack, but filter filter_quickedit_authors and include only author with ID 0. + * Also hide if only one author just in case someone someone has created author with 0. + * + * @param array $options Options. + * @return array Options. + */ +function hide_quickedit_authors( array $options ) : array { + $users_opt['hide_if_only_one_author'] = true; + $users_opt['include'] = [ 0 ]; + return $users_opt; +}