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

Don't search and replace with co-author post_id #624

Merged
merged 1 commit into from
Nov 22, 2018
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
6 changes: 6 additions & 0 deletions co-authors-plus.php
Original file line number Diff line number Diff line change
Expand Up @@ -715,6 +715,12 @@ function posts_where_filter( $where, $query ) {

$id = is_author() ? get_queried_object_id() : '\d+';

//If we have an ID but it's not a "real" ID that means that this isn't the first time the filter has fired and the object_id has already been replaced by a previous run of this filter. We therefore need to replace the 0
// This happens when wp_query::get_posts() is run multiple times.
if ( false === get_user_by( 'id', $id ) ){
$id = 0;
}

// When WordPress generates query as 'post_author IN (id)'.
if ( false !== strpos( $where, "{$wpdb->posts}.post_author IN " ) ) {

Expand Down