- This topic has 1 reply, 2 voices, and was last updated 7 years, 9 months ago by .
Viewing 2 posts - 1 through 2 (of 2 total)
Viewing 2 posts - 1 through 2 (of 2 total)
These forums are now closed and remain for historical purposes.
None of the content applies to the new version 3. For support, get in touch via our contact form.
Forums › Forums › Search & Filter Pro › Is there a way to exclude the the current Post ID?
Tagged: Exclude Posts
On a news page I am pulling through other news articles using search & Filter Pro, I would like to exclude the current News article from being pulled through from the list.
Is there a variable or dynamic way to get the current post id to enter into “Exclude Post IDs”?
I am displaying as a widget if that makes a difference.
So, you have a single post on the page and a loop of other posts? The only way to do this would be for you to custom code some PHP to get the current post ID (using the WordPress get_the_ID() function I would guess). Then you can use this in our Edit Query Arguments filter and add an argument to the filter to exclude that post:
https://searchandfilter.com/documentation/action-filter-reference/#edit_query_arguments