Skip to content

Commit

Permalink
fix(guest-authors-for-cli): allow GAs for CLI context (simplified)
Browse files Browse the repository at this point in the history
  • Loading branch information
ronchambers committed Dec 8, 2024
1 parent d04bfe9 commit d8c7978
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions includes/plugins/co-authors-plus/class-guest-contributor-role.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,24 +98,16 @@ public static function initialize() {
* @return void
*/
public static function early_init() {

// Enable Guest Authors...
// -- if constant exists and is true.
if ( defined( 'NEWSPACK_ENABLE_CAP_GUEST_AUTHORS' ) && NEWSPACK_ENABLE_CAP_GUEST_AUTHORS ) {
return;
}
// -- if site already has Guest Authors.
if ( self::site_has_cap_guest_authors() ) {
return;
}
// -- if CLI context.
if ( defined( 'WP_CLI' ) && WP_CLI ) {
return;
}

// Disable Guest Authors.
add_filter( 'coauthors_guest_authors_enabled', '__return_false' );
add_action( 'admin_menu', [ __CLASS__, 'guest_author_menu_replacement' ] );
if ( ! self::site_has_cap_guest_authors() ) {
add_filter( 'coauthors_guest_authors_enabled', '__return_false' );
add_action( 'admin_menu', [ __CLASS__, 'guest_author_menu_replacement' ] );
}
}

/**
Expand Down

0 comments on commit d8c7978

Please sign in to comment.