posts_join_filter() adds some SQL to the query string. However, if you are using query_posts() to modify the default search for a page, posts_join_filter() has already run (courtesy of WordPress before entering the theme page), and the second running (in response to the call to query_posts()) adds the SQL again, which results in an SQL syntax error, and no posts returned. I think it should probably check to see if it’s already run. I used strpos() to check if $join already contains the new SQL, and if so, skip adding it. So far, this has worked for me, with no bad effects I’ve noticed.
Basically, I just created a variable equal to the same text you appended, then checked to see if was already there before appending it.
By the way, I also ran into a conflict between co-authors-plus and collapsing-archives, but that problem looks like its not in your code or implementation. I think your implementation is fine, I just mention this in case someone else brings it up.
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘[Plugin: Co-Authors Plus] Bug in posts_join_filter() ?’ is closed to new replies.