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

Probable fix for https://github.com/INN/Largo/issues/1381 #1385

Merged
merged 2 commits into from
Dec 13, 2016

Conversation

benlk
Copy link
Collaborator

@benlk benlk commented Dec 9, 2016

I'm not able to duplicate the bug described in #1381, but this looks like a fix: exclude the current post from the posts that get returned in any query in the Largo_Related class, which is what feeds the Largo Related Posts widget.

Please wait for tests on this one.

I'm not able to duplicate the bug described in #1381, but this looks like a fix: exclude the current post from the posts that get returned in any query in the Largo_Related class, which is what feeds the Largo Related Posts widget.

Please watch tests on this one.
@benlk
Copy link
Collaborator Author

benlk commented Dec 9, 2016

Tests are a 👍

@rclations rclations assigned benlk and unassigned rclations Dec 12, 2016
@@ -33,6 +33,7 @@ function widget( $args, $instance ) {
$rel_posts = new WP_Query( array(
'post__in' => $related->ids(),
'nopaging' => 1,
'post__not_in' => array( $post->ID ),
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this makes it work in your testing, then I'm fine with it, but I'm puzzled.

https://codex.wordpress.org/Class_Reference/WP_Query#Post_.26_Page_Parameters

'post__not_in' should be ignored when 'post__in' is set in WP_Query.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the specific issue I ran into was then post__in was blank

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, then this makes sense. 👍

Related: #884

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants