Skip to content
Open
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
11 changes: 10 additions & 1 deletion php/class-wp-cli.php
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,16 @@ public function assign_user_to_coauthor( $args, $assoc_args ): void {
WP_CLI::error( __( 'Please specify a valid co-author login', 'co-authors-plus' ) );
}

$post_types = implode( "','", $coauthors_plus->supported_post_types() );
$post_types = implode(
', ',
array_map(
function ( $post_type ) {
return "'{$post_type}'";
},
$coauthors_plus->supported_post_types()
)
);

// phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared,WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching
$posts = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_author=%d AND post_type IN ({$post_types})", $user->ID ) );
$affected = 0;
Expand Down