Notice removed Authoritative reference needed by Community
    Bounty Ended with Otto's answer chosen by Community
    Tweeted twitter.com/#!/StackWordPress/status/146279212926509057
    Notice added Authoritative reference needed by v0idless
    Bounty Started worth 50 reputation by v0idless
2 added 231 characters in body
source | link

I have a custom taxonomy called coauthor. On the edit.php screen, I am trying filter and only show posts authored by the current user OR posts coauthored by the current user. I can get the posts authored by the current user:

function get_authored_posts($query) {
    global $user_ID;
    $query->set('author',  $user_ID);
    return $query;
}
add_filter('pre_get_posts', 'get_authored_posts');

I can also get the posts coauthored by the current user:

function get_coauthored_posts($query) {
    global $user_ID;
    $user = get_userdata($user_ID);
    $query->set('taxonomy', 'coauthor');
    $query->set('term', $user->user_login);
    return $query;
}
add_filter('pre_get_posts', 'get_coauthored_posts');

I believe the results yield posts authored AND coauthored by the current user. I am looking for posts authored OR coauthored by the current user. I am expecting the results from the first and the results from the second to be displayed.

Note: To clarify, coauthors are stored as terms as part of the coauthor taxonomy. The term is the user_login value.

== EDIT ==

I am currently storing the author as a coauthor. I feel like this is a "work around" for a better solution. How/Can I use a direct query (ignoring the WP_Query object) and return that from the pre_get_posts filter?

I have a custom taxonomy called coauthor. On the edit.php screen, I am trying filter and only show posts authored by the current user OR posts coauthored by the current user. I can get the posts authored by the current user:

function get_authored_posts($query) {
    global $user_ID;
    $query->set('author',  $user_ID);
    return $query;
}
add_filter('pre_get_posts', 'get_authored_posts');

I can also get the posts coauthored by the current user:

function get_coauthored_posts($query) {
    global $user_ID;
    $user = get_userdata($user_ID);
    $query->set('taxonomy', 'coauthor');
    $query->set('term', $user->user_login);
    return $query;
}
add_filter('pre_get_posts', 'get_coauthored_posts');

I believe the results yield posts authored AND coauthored by the current user. I am looking for posts authored OR coauthored by the current user. I am expecting the results from the first and the results from the second to be displayed.

Note: To clarify, coauthors are stored as terms as part of the coauthor taxonomy. The term is the user_login value.

I have a custom taxonomy called coauthor. On the edit.php screen, I am trying filter and only show posts authored by the current user OR posts coauthored by the current user. I can get the posts authored by the current user:

function get_authored_posts($query) {
    global $user_ID;
    $query->set('author',  $user_ID);
    return $query;
}
add_filter('pre_get_posts', 'get_authored_posts');

I can also get the posts coauthored by the current user:

function get_coauthored_posts($query) {
    global $user_ID;
    $user = get_userdata($user_ID);
    $query->set('taxonomy', 'coauthor');
    $query->set('term', $user->user_login);
    return $query;
}
add_filter('pre_get_posts', 'get_coauthored_posts');

I believe the results yield posts authored AND coauthored by the current user. I am looking for posts authored OR coauthored by the current user. I am expecting the results from the first and the results from the second to be displayed.

Note: To clarify, coauthors are stored as terms as part of the coauthor taxonomy. The term is the user_login value.

== EDIT ==

I am currently storing the author as a coauthor. I feel like this is a "work around" for a better solution. How/Can I use a direct query (ignoring the WP_Query object) and return that from the pre_get_posts filter?

1
source | link

pre_get_posts OR relation between taxonomy and author

I have a custom taxonomy called coauthor. On the edit.php screen, I am trying filter and only show posts authored by the current user OR posts coauthored by the current user. I can get the posts authored by the current user:

function get_authored_posts($query) {
    global $user_ID;
    $query->set('author',  $user_ID);
    return $query;
}
add_filter('pre_get_posts', 'get_authored_posts');

I can also get the posts coauthored by the current user:

function get_coauthored_posts($query) {
    global $user_ID;
    $user = get_userdata($user_ID);
    $query->set('taxonomy', 'coauthor');
    $query->set('term', $user->user_login);
    return $query;
}
add_filter('pre_get_posts', 'get_coauthored_posts');

I believe the results yield posts authored AND coauthored by the current user. I am looking for posts authored OR coauthored by the current user. I am expecting the results from the first and the results from the second to be displayed.

Note: To clarify, coauthors are stored as terms as part of the coauthor taxonomy. The term is the user_login value.