Hey there! You're using an out-of-date browser, so this site probably looks pretty funny. Upgrade your browser for the full experience.

Programmatically Controlling Events Calendar Pro

If you’re not familiar with The Events Calendar Pro from Modern Tribe, it’s amazing and part of standard install when building a WordPress site.

One of the things that I see a lot of people asking about is how to programmatically control the events page.

The default behavior is that all published events appear on the calendar which brings up the question of what if you want to selectively control which events are visible.

It turns out to be pretty simple thanks to the pre_get_posts action.

All you need is a little bit of code in you functions.php.

Let’s break down the above.

The first two if statements ensure that we’re only modifying the query when displaying the Events calendar.

For this example, we’re saying that we have an event category called Hidden

We modify the query to only display events that are NOT IN the Hidden category.

It’d be just as easy to only display events that do belong to a certain category (or multiple categories).

From there, the sky’s the limit. It’s that simple!

Born and raised in
Louisville, Kentucky.


223 S. Clay St

Work With Us

  • This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.
  • This field is for validation purposes and should be left unchanged.