Posted: May 28, 2021 at 2:09 am
Hi, A while ago we implemented the code in the following ticket: to remove password-protected and sold out events from event lists. It has been working fine. We are switching over to using category-specific event shortcodes instead, eg However, the function above is not being called and password-protected events are being shown. Do I need to use a different filter/hook? Best wishes, Anita |
|
Hi Anita, That function doesn’t remove password-protected events, it only prevents posts with a status of ‘sold_out’ from showing. May I ask how you previously displayed the events where the password-protected events didn’t show? |
|
We were previously just using the event list archive. |
|
I remember adding that line of code, but don’t know where to add similar for events produced using the shortcode. |
|
My apologies, that’s me being completely blind to half of the code! So the code used in that snippet should just apply to both the archive and instances of the ESPRESSO_EVENTS shortcode by default. It isn’t checking if you are within the main query so applies any time WP_Query is used (the shortcode uses it) to pull espresso_events posts. I just threw your snippet into a custom functions plugin to confirm if this worked and didn’t run into any problems: https://monosnap.com/file/GdEyVGL8qxpGYuNGi2m5donqc6PxxZ Thats just using:
You could try adding a |
|
No worries. I look at things but don’t see them sometimes too. In this case, the code is working right, it’s just that some of the events which should be password-protected don’t have a password! |
|
Ah, yeah, that’ll also do it 🙂 Glad you found the cause. |
|
The support post ‘Password-protected events are appearing when we use an event shortcode’ is closed to new replies.
Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.