Your cart is currently empty!
Custom restiction
—
by
Hi, I’m trying to figure out if it’s possible to create this rule.
Hide a specific post type if:
– – if the post is from the current year
– – the user is not part of the “jury” group
– – user is not the author of the post
– – post taxonomy is “open”
do you think it is doable?
thanks in advance
Posted in Groups
Comments
One response to “Custom restiction”
Hi Emanuele,
Welcome back to our support forum.
For a case like this, I think you should better use pre_get_posts hook and adjust the query parameters, fetching only those posts that don’t match the parameters you choose.
Please have a look at the definition and supported parameters here:
– https://developer.wordpress.org/reference/hooks/pre_get_posts/
As for the conditional for the user-group check, you can have a look at the example – Does the current user belong to the Foobar group? – located in the Examples section of Groups documentation.
Kind regards
George