I want to write a custom function that will limit the calendar events query to only the results from a specific category.
Does anyone know how write a WordPress function, such as ‘pre_get_posts’, to limit the events by a category?
function limit_events_by_category( $query ) {
/* code to limit the events by a category */
return $query;
}
add_action( 'pre_get_posts', 'limit_events_by_category' );
(Also, that will not affect any theme custom navigation, thanks)
Thanks for reaching out to us and for the heads-up on the resolution of the issue 🙂
The code looks good! Great job!
I’ll go ahead and close out this thread, but if you need help with anything else please don’t hesitate to create a new one and we will be happy to assist you.
Best,
Nico
Author
Posts
Viewing 3 posts - 1 through 3 (of 3 total)
The topic ‘Function to Limit Events By Category’ is closed to new replies.