-
-
Notifications
You must be signed in to change notification settings - Fork 83
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
Exclude the current post from yet another area where we're creating lists of IDs #1403
Conversation
…ists of related post IDs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just some minor code standards stuff, otherwise g2g
inc/related-content.php
Outdated
! in_array( $q->post->ID, $this->post_ids ) // only add it if it wasn't already there | ||
&& $q->post->ID != $this->post_id // do not add the id of the current post, because we do not want to ever return that | ||
) { | ||
$this->post_ids[] = (int) trim($q->post->ID); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
spaces inside trim() parenthesis
inc/related-content.php
Outdated
$this->post_ids[] = (int) trim( $q->post->ID ); | ||
if ( | ||
! in_array( $q->post->ID, $this->post_ids ) // only add it if it wasn't already there | ||
&& $q->post->ID != $this->post_id // do not add the id of the current post, because we do not want to ever return that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
!==
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should allow type juggling here, because of the possibility that we may be comparing a string post ID to a numeric post ID.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
makes sense
Changes
add_from_query
, the method of the class that is responsible for generating lists of IDs in multiple parts of theLargo_Related
class.Why
Something in one of the two calls to
WP_Query
inLargo_Related->get_series_posts()
is ignoring thepost__not_in
argument on the query, so now I'm going to just exclude the current post's post ID from ever being added to the list of IDsThis is because of HelpScout ticket 559, and is a continuation of issue #1381 and the work done in PR #1385.