Is there a way to exclude the the current Post ID?

Forums › Forums › Search & Filter Pro › Is there a way to exclude the the current Post ID?

Tagged: 

Viewing 2 posts – 1 through 2 (of 2 total)
  • Anonymous
    #182628

    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.

    Trevor
    #182666

    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

Viewing 2 posts – 1 through 2 (of 2 total)
Search & Filter Support
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.

We also use cookies to store items in your cart as well as allowing your to login on the site.

You can adjust all of your cookie settings by navigating the tabs on the left hand side.

By continuing to use this site, you also agree to our Privacy Policy.