Here’s where I landed. It’s rough but working for the moment.
// remove 0 = 1
$clauses[ ‘where’ ] = preg_replace( ‘/0\s\=\s1/i’, ”, $clauses[ ‘where’ ] );
// remove empty () and Extra AND
$clauses[ ‘where’ ] = preg_replace( ‘/AND\s\(\s\n\s\s\n\)/i ‘, ”, $clauses[ ‘where’ ] );
The short story is that (at least in my version), there are stray whitespace and line return characters surrounding the 0=1 so the pattern match needed to be tweaked. It wasn’t until I did a query echo AND viewed the source did I find this. I am curious is this is true for others.
The outstanding issue I’m noticing is that clicking the relationship link from the posts admin page isn’t bringing everything back. It’s linking on slug and the query is sometimes doing weird things. Adding extra where conditions and not always correctly pulling all associated posts. Forcing the “relationship” post ID int the URL seems to bring everything back. I haven’t tried to dig into where that tweak is yet.