Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support jathinhelp

    (@jathinhelp)

    Hello,
    @eventaus You need to paste the below code in your theme functions.php file in the third line inside the bracket you need to put the event id which you need to hide.

    function hide_specific_events($query_args, $args) {
        // IDs of the events you want to hide
        $event_ids_to_hide = array(101, 102, 103); // Replace with your event IDs

        // Add post__not_in parameter to exclude specific event IDs
        if (!isset($query_args[‘post__not_in’])) {
            $query_args[‘post__not_in’] = array();
        }
        $query_args[‘post__not_in’] = array_merge($query_args[‘post__not_in’], $event_ids_to_hide);

        return $query_args;
    }
    add_filter(‘get_event_listings_query_args’, ‘hide_specific_events’, 10, 2);

    • This reply was modified 1 year, 8 months ago by jathinhelp.
    Thread Starter eventaus

    (@eventaus)

    Thank you, sorry the short code was [events]

    Thread Starter eventaus

    (@eventaus)

    All working thank you, the syntax were wrong like quotation marks, fixed it up

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Hide Specific Events from Event Listings’ is closed to new replies.