Private posts showing in output
-
It looks like as of v2.3.1 this plugin uses the
get_posts_by_author_sql()
method to build a portion of the where clause for the SQL query that retrieves the posts. However, it uses mostly the default values for this method. This means that the statementOR post_status = 'private'
is included in the SQL. It would be ideal if it was possible to either by filter or parameter modify this behavior. The fourth argument for this method is$public_only
which will limit the posts queried to only public posts.We have implemented a temporary fix to the problem we are currently having by way of the
related_posts_by_taxonomy_posts_where
filter and replacing theOR post_status = 'private'
portion of the where statement with empty string. I feel like this is a hacky solution and an official parameter or filter would be better and less prone to break unexpectedly.Our fix:
add_filter('related_posts_by_taxonomy_posts_where', function ($where) { return str_replace("OR post_status = 'private'", '', $where); });
Is there a better solution that I have missed? Otherwise it would be really nice to have this added feature.
- The topic ‘Private posts showing in output’ is closed to new replies.