Skip to content

Commit

Permalink
Merge pull request #126 from humanmade/18-hide-author-field-in-quickedit
Browse files Browse the repository at this point in the history
Hide author field in quickedit
  • Loading branch information
roborourke authored Jul 25, 2024
2 parents c8040c5 + c719378 commit b6e9b07
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions inc/namespace.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,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' );
}

/**
Expand Down Expand Up @@ -752,3 +753,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 {

Check failure on line 766 in inc/namespace.php

View workflow job for this annotation

GitHub Actions / PHP Coding Standards

Function Authorship\hide_quickedit_authors() has parameter $options with no value type specified in iterable type array.

Check failure on line 766 in inc/namespace.php

View workflow job for this annotation

GitHub Actions / PHP Coding Standards

Function Authorship\hide_quickedit_authors() return type has no value type specified in iterable type array.
$users_opt['hide_if_only_one_author'] = true;
$users_opt['include'] = [ 0 ];
return $users_opt;
}

0 comments on commit b6e9b07

Please sign in to comment.