Hook Reference

Heads up! This reference contains PHP code and is intended for developers. We offer this code as a courtesy but don’t provide support for code customizations or 3rd party development.

For a simple approach to adding custom code to your WordPress site, please see WPBeginner’s guide to using WPCode.

Would you like to extend or customize Sugar Calendar Events with your own code? Sugar Calendar Events includes action and filter hooks that let you add content, change data, and run code when things happen, such as when someone saves an event or completes a ticket order.

In this tutorial, we’ll show you how to use the hooks in Sugar Calendar Events and where to find the right one for your project.


Before getting started, make sure Sugar Calendar Events is installed and activated on your WordPress site.

Note: Hooks marked (Pro) only run with a paid Sugar Calendar Events license. A dash (—) in the Since column means the hook predates version tracking.

How to Use Hooks

Sugar Calendar Events has two kinds of hooks:

  • Action hooks run your code at a specific point, for example, to output extra content on the event page. Attach code to them with add_action().
  • Filter hooks pass a value through your code so you can change it, for example, to change the From name on emails. Attach code to them with add_filter(), and always return a value.

Add your code to a code snippets plugin or to your child theme’s functions.php file, so theme updates don’t remove it. For example, this snippet adds a line of text after the description on every single event page:

add_action( 'sc_after_event_content', function () {
	echo '<p>Doors open 30 minutes before the start time.</p>';
} );

To learn more about how hooks work, see the WordPress guides to action hooks and filter hooks.

Single Event Pages

Use these hooks to change what visitors see on a single event page. The event details rows run on sugar_calendar_frontend_event_details at these priorities: date (20), time (30), location (40), link (45), and calendars (50). Choose a priority to place your own row between them.

HookTypeSinceWhat it does
sugar_calendar_frontend_event_details_beforeAction3.1.0Fires before the event details box. Passes $event.
sugar_calendar_frontend_event_detailsAction3.1.0Outputs the event details rows. Hook in at a priority to add your own row. Passes $event.
sugar_calendar_frontend_event_details_dateAction3.1.0Fires after Sugar Calendar Events outputs the event date. Passes $event.
sugar_calendar_frontend_event_badgesFilter3.14.0Changes the badges shown above the event details, such as Featured. Passes $badges and $event.
sugar_calendar_frontend_loader_event_objectFilter3.6.0Changes the event object used to build the event details. Passes $event.
sc_before_event_contentAction—Fires before the event description. Passes $post_id.
sc_after_event_contentAction1.0Fires after the event description. Passes $post_id and $event.
sc_event_detailsAction2.0.7Fires where Sugar Calendar Events adds the event details to the content. Passes $post_id.
sc_event_content_hooks_eventFilter3.6.0Changes the event object before Sugar Calendar Events outputs the event content. Passes $event.
sugar_calendar_get_single_event_appearance_modeFilter3.3.0Changes the Event Page Appearance setting (light or dark).
sugar_calendar_helpers_get_event_excerptFilter3.11.0Changes an event’s excerpt. Passes $excerpt and the post ID.
sugar_calendar_helpers_get_event_contentFilter3.14.0Changes an event’s full description. Passes $content and the post ID.
sugar_calendar_structured_data_enabledFilter3.12.0Return false to stop Sugar Calendar Events from adding event structured data (JSON-LD) to the page. Passes $enabled and $event.
sugar_calendar_structured_data_providersFilter3.12.0Changes the list of structured data (schema) providers.

Events Archive

When your theme has no archive-sc_event.php file, Sugar Calendar Events displays the events archive as a built-in Events page. To learn more, see our guide to customizing template files.

HookTypeSinceWhat it does
sugar_calendar_frontend_loader_virtual_postFilter3.10.0Changes the built-in Events page, such as its title or the Event List shortcode it displays. Passes the page object.

Calendar and Event List Blocks

These hooks change the Calendar and Event List blocks and their shortcodes.

HookTypeSinceWhat it does
sugar_calendar_block_calendar_view_month_eventsFilter3.6.0Changes the events shown in the Calendar block’s month view. Passes the events, the date range, and the block’s calendars.
sugar_calendar_block_common_abstract_block_get_week_eventsFilter3.6.0Changes the events shown in the week view.
sugar_calendar_block_calendar_view_day_eventsFilter3.6.0Changes the events shown in the day view.
sugar_calendar_block_common_abstract_block_get_max_events_countFilter3.7.0Changes the maximum number of events a block loads.
sugar_calendar_block_common_abstract_block_is_featured_onlyFilter3.14.0Changes whether a block shows only featured events. Passes $featured_only and the block.
sugar_calendar_block_popover_event_ctaFilter3.12.0Changes the call-to-action button in the Calendar block’s event popover. Passes $cta (label, link, and type), the post ID, and the event ID.
sugar_calendar_block_calendar_loader_popover_image_sizeFilter3.5.0Changes the image size in the Calendar block’s event popover. Default medium.
sugar_calendar_block_list_gridview_image_sizeFilter3.5.0Changes the image size in the Event List block’s grid view. Default medium.
sugar_calendar_block_list_listview_image_sizeFilter3.5.0Changes the image size in the Event List block’s list view. Default medium.
sugar_calendar_block_event_list_event_list_view_event_view_dt_displayFilter3.7.0Changes the date and time text in the Event List block. Passes the text, $event, the date, and the time format.
sugar_calendar_blocks_get_visitor_timezoneFilter3.1.2Changes the visitor time zone used to convert event times.
sugar_calendar_block_show_venue_filterFilter3.5.0Return false to hide the venue filter in blocks. (Pro)
sugar_calendar_features_tags_frontend_blocks_show_tags_filterFilter3.7.0Return false to hide the tag filter in blocks.
sugar_calendar_pro_features_speakers_frontend_blocks_show_speaker_filterFilter3.7.0Return false to hide the speaker filter in blocks. (Pro)
sugar_calendar_block_popover_additional_filtersAction3.5.0Fires after the calendars filter in the Calendar block’s filter popover, so you can add your own filter controls.

Event Data and Queries

Use these hooks to change how events are queried, or to run code when events are saved.

HookTypeSinceWhat it does
sugar_calendar_get_events_argsFilter3.6.0Changes the arguments used to query events.
sugar_calendar_added_eventAction3.6.0Fires after Sugar Calendar Events adds an event. Passes the event ID and the saved data.
sugar_calendar_updated_eventAction3.6.0Fires after Sugar Calendar Events updates an event. Passes the event ID, the saved data, and the event before the update.
sugar_calendar_event_duplicatedAction3.11.0Fires after Sugar Calendar Events duplicates an event. Passes the new and original event IDs and post IDs. (Pro)
sugar_calendar_event_constructFilter2.2.0Changes an event object as Sugar Calendar Events creates it.
sugar_calendar_meta_dataFilter3.4.0Changes the event meta data schema, so you can register your own event fields.
sugar_calendar_exclude_ghost_eventsFilter3.11.0Changes whether queries skip events whose post no longer exists. Default true.

Post Types and Taxonomies

These filters change how Sugar Calendar Events registers its post types and taxonomies. To change the Calendars taxonomy, use the WordPress register_taxonomy_args filter for sc_event_category.

HookTypeSinceWhat it does
sc_event_labelsFilter2.0.0Changes the labels of the Events post type.
sc_event_supportsFilter—Changes the features the Events post type supports, such as thumbnail or comments.
sc_event_rewriteFilter—Changes the rewrite settings of the Events post type. To change the slug, see our guide to updating the event slug.
sc_event_capability_typeFilter—Changes the capability types of the Events and Venues post types.
sugar_calendar_tags_taxonomy_labelsFilter3.7.0Changes the labels of the Tags taxonomy.
sugar_calendar_tags_taxonomy_slugFilter3.7.0Changes the slug of the Tags taxonomy.
sugar_calendar_tags_taxonomy_rewriteFilter3.7.0Changes the rewrite settings of the Tags taxonomy.
sc_venue_labelsFilter3.5.0Changes the labels of the Venues post type. (Pro)
sc_venue_rewriteFilter3.5.0Changes the rewrite settings of the Venues post type. (Pro)
sugarcalendar_venue_supportsFilter3.5.0Changes the features the Venues post type supports. (Pro)
sc_speakers_post_type_slugFilter3.7.0Changes the slug of the Speakers post type. (Pro)
sc_speakers_post_type_supportsFilter3.7.0Changes the features the Speakers post type supports. (Pro)

Venues, Speakers, and Maps

Use these hooks to change single venue and speaker pages, and the address and coordinates sent to Google Maps.

HookTypeSinceWhat it does
sc_venue_details_beforeAction3.5.0Fires before the details on a single venue page. Passes $venue_data. (Pro)
sc_venue_detailsAction3.5.0Outputs the details on a single venue page. Passes $venue_data. (Pro)
sc_venue_details_afterAction3.5.0Fires after the details on a single venue page. Passes $venue_data. (Pro)
sugarcalendar_venue_supported_countriesFilter3.5.0Changes the list of countries available for venue addresses. (Pro)
sc_speaker_details_beforeAction3.7.0Fires before the details on a single speaker page. Passes $speaker_data. (Pro)
sc_speaker_detailsAction3.7.0Outputs the details on a single speaker page. Passes $speaker_data. (Pro)
sc_speaker_details_afterAction3.7.0Fires after the details on a single speaker page. Passes $speaker_data. (Pro)
sc_speaker_details_social_linksFilter3.7.0Changes a speaker’s social links. (Pro)
sugar_calendar_common_features_google_maps_feature_addressFilter3.10.0Changes the address sent to Google Maps. Passes $address and $event.
sugar_calendar_common_features_google_maps_feature_coordinatesFilter3.5.0Changes the map coordinates for an event. Passes $coordinates and the event ID.

Emails

These hooks apply to the emails Sugar Calendar Events sends, such as ticket receipts and registration emails.

HookTypeSinceWhat it does
sc_email_from_nameFilter1.0.0Changes the email From name.
sc_email_from_addressFilter1.0.0Changes the email From address.
sc_email_headersFilter1.0.0Changes the email headers.
sc_email_attachmentsFilter1.0Changes the email attachments.
sc_email_messageFilter1.0.0Changes the email message content.
sc_email_footer_textFilter1.0Changes the email footer text.
sc_email_tagsFilter1.0Adds or changes the Smart Tags available in emails.
sc_email_send_beforeAction1.0Fires before Sugar Calendar Events sends an email.
sc_email_send_afterAction1.0Fires after Sugar Calendar Events sends an email.
sugar_calendar_emails_stylingFilter3.14.0Changes the Email Styling values, such as colors and the header image.
sugar_calendar_emails_calendar_urlFilter3.14.0Changes the Add to Calendar link in emails. Passes the URL and the email context.
sugar_calendar_admin_notification_recipientFilter3.14.0Changes who receives admin notification emails. Default is the site admin email. Passes the address and the email ID.

Event Ticketing

Use these hooks to customize ticket checkout, orders, and the ticket form. To learn more about tickets, see our Event Ticketing guide.

HookTypeSinceWhat it does
sc_et_checkout_completeAction3.12.0Fires once after Sugar Calendar Events fully saves a ticket order, including its tickets and attendees. Passes the order details and $order_id.
sc_et_checkout_complete_payloadFilter3.12.0Changes the order details passed to sc_et_checkout_complete.
sc_et_order_{$new_status}Action3.12.0Fires when an existing order changes status, such as sc_et_order_refunded. Passes the order details, $order_id, and the old status.
sc_et_order_status_actionsFilter3.12.0Changes which statuses fire sc_et_order_{$new_status}. Default paid, pending, refunded, and trash.
sugar_calendar_ticketing_order_deletedAction3.13.0Fires after Sugar Calendar Events deletes an order and its data. Passes $order_id.
sc_et_checkout_validate_dataAction3.6.0Fires while Sugar Calendar Events validates checkout data, so you can add your own checks.
sc_et_success_page_urlFilter—Changes the page visitors go to after a successful checkout.
sc_et_should_display_ticketsFilter3.2.0Changes whether tickets display for an event. Passes the value and $event.
sc_et_purchase_button_htmlFilter1.1.0Changes the ticket purchase button HTML. Passes the HTML and $event.
sc_event_tickets_form_topAction3.8.0Fires at the top of the ticket form. Passes $event and the post ID.
sc_event_tickets_form_bottomAction1.0.0Fires at the bottom of the ticket form. Passes $event and the post ID.
sc_et_modal_attendee_fields_afterAction3.8.0Fires after the attendee fields in the checkout window. Passes $event.
sc_et_modal_form_bottomAction3.6.0Fires before the end of the checkout form. Passes $event.
sc_et_currenciesFilter1.0.0Changes the list of supported currencies.
sc_et_currencyFilter1.0.0Changes the store currency.
sc_et_format_amountFilter1.0.0Changes how prices are formatted.
sc_et_stripe_statement_descriptorFilter3.3.0Changes the text on customers’ card statements. Default Event Tickets.
sc_event_tickets_list_table_columnsFilter1.0.0Changes the columns in the admin orders table.
sc_et_export_capabilityFilter1.0.0Changes the capability needed to export orders and attendees.
sugar_calendar_ticketing_use_legacy_receiptFilter3.14.0Return true to show the older table-style receipt instead of the card.
sugar_calendar_ticketing_use_legacy_detailsFilter3.14.0Return true to show the older table-style ticket details instead of the card.

Registration Forms

These filters change how event registration forms work. To learn more, see our guide to creating a registration form.

HookTypeSinceWhat it does
sugar_calendar_registration_form_max_attendeesFilter3.13.0Changes the maximum number of attendees per submission. Default 100. (Pro)
sugar_calendar_registration_reminders_enabledFilter3.13.0Return false to stop reminder emails for unfinished registrations. (Pro)
sugar_calendar_registration_reminder_thresholdFilter3.13.0Changes how long, in seconds, an unfinished registration waits before a reminder. Default one hour. (Pro)
sugar_calendar_registration_rate_limiter_enabledFilter3.13.0Return false to turn off the registration rate limiter. (Pro)
sugar_calendar_registration_rate_limiter_limitFilter3.13.0Changes how many registration attempts a visitor can make per time window. (Pro)
sugar_calendar_registration_rate_limiter_client_ipFilter3.13.0Changes the visitor IP the rate limiter uses, for example, behind a proxy. Default REMOTE_ADDR. (Pro)

Calendar Feeds, Import, and Export

Use these hooks to change calendar feeds and Add to Calendar links, and to run code during imports and exports.

HookTypeSinceWhat it does
sugar_calendar_calendar_feeds_eventsFilter3.11.0Changes the events included in calendar feeds. (Pro)
sugar_calendar_pro_features_calendar_feeds_helpers_linksFilter3.10.0Changes the Add to Calendar links on events. Passes the links and $event. (Pro)
sugar_calendar_ics_sync_fetch_timeoutFilter3.13.0Changes the time limit, in seconds, for fetching scheduled ICS imports. Default 30. (Pro)
sugar_calendar_pro_importer_ics_event_dataFilter3.6.0Changes each event’s data during an ICS import. (Pro)
sugar_calendar_importer_startedAction3.15.0Fires when an import starts. Passes the source: tec, json, or ics.
sugar_calendar_importer_completedAction3.15.0Fires when an import finishes. Passes the source and the number of events imported.
sc_import_tec_events_limitFilter3.3.0Changes how many events from The Events Calendar import per batch. Default 10.
sugar_calendar_admin_tools_export_csv_event_columnsFilter3.13.0Adds or changes columns in the events CSV export.

Admin Area

Use these hooks to add your own fields to the event editor, change admin permissions, and customize the admin events list.

HookTypeSinceWhat it does
sugar_calendar_admin_meta_box_setup_sectionsAction3.0.0Fires when the event settings box registers its tabs. Call $metabox->add_section() with an id, label, icon, order, and callback to add your own tab.
sugar_calendar_admin_meta_box_sectionsFilter3.0.0Changes the tabs in the event settings box.
sc_event_meta_box_beforeAction3.0.0Outputs table rows in an Other tab of the event settings box. The tab only appears when your code uses this hook.
sc_event_meta_box_afterAction3.0.0Outputs table rows at the end of the Other tab.
sugar_calendar_get_capability_manage_optionsFilter3.0.0Changes the capability needed to manage Sugar Calendar Events settings. Default manage_options.
sugar_calendar_admin_area_capabilityFilter3.0.1Changes the capability needed to see the Events menu. Default edit_events.
sugar_calendar_manage_sc_event_posts_columnsFilter3.12.0Adds or changes columns in the admin events list.
sugar_calendar_admin_events_tables_base_{$column_name}_contentsFilter3.0.0Changes the contents of a column in the admin events list.
sugar_calendar_admin_pages_settings_get_tabsFilter3.0.0Adds or changes the tabs on the Events » Settings page.
sugar_calendar_admin_flyout_menuFilter3.9.0Return false to hide the quick links menu in the admin.

Integrations and AI

Use these hooks to respond to integration connections, change Zoom and Google Meet meetings, control Google Calendar syncing, and control the AI features.

HookTypeSinceWhat it does
sugar_calendar_integration_connectedAction3.15.0Fires after an integration connects or reconnects. Passes the provider slug, such as zoom.
sugar_calendar_integration_disconnectedAction3.15.0Fires after an integration disconnects. Passes the provider slug.
sugar_calendar_zoom_meeting_settingsFilter3.12.0Changes the settings Sugar Calendar Events sends to Zoom when it creates a meeting. Passes $settings and $event.
sugar_calendar_zoom_webhook_event_{$event_type}Action3.12.0Fires after Sugar Calendar Events handles a Zoom webhook event. Passes the webhook payload.
sugar_calendar_online_meeting_changedAction3.16.0Fires after an event’s online meeting is created, removed, or switched in the event editor. Passes the event.
sugar_calendar_integrations_before_disableAction3.16.0Fires before Sugar Calendar Events Lite deletes its stored connections when Disable Integrations is turned on.
sugar_calendar_google_calendar_mappingFilter3.16.0Maps Google calendars to Sugar Calendar calendars, each with its own sync direction. Replaces the calendar and direction saved on the Integrations tab.
sugar_calendar_google_pull_window_daysFilter3.16.0Sets how many days ahead the first Google sync imports existing events. Defaults to 0 (none). Use -1 for no limit.
sugar_calendar_google_pull_event_statusFilter3.16.0Changes the post status of events created from Google Calendar. Defaults to publish.
sugar_calendar_google_pull_event_dataFilter3.16.0Changes the event data from a Google event before Sugar Calendar Events saves it. Passes $data and the Google event.
sugar_calendar_google_pulled_eventAction3.16.0Fires after a Google event is saved in Sugar Calendar Events. Passes the event ID and the saved data.
sugar_calendar_google_description_mapFilter3.16.0Changes the rewrites applied to an event description before it’s sent to Google Calendar.
sugar_calendar_google_description_tagsFilter3.16.0Changes the HTML tags kept in an event description sent to Google Calendar.
sugar_calendar_google_meet_space_configFilter3.16.0Changes the Google Meet meeting settings, such as who can join without asking. Passes $config and $event.
sugar_calendar_google_pull_chunk_sizeFilter3.16.0Sets how many Google events each background sync run fetches. Defaults to 250.
sugar_calendar_google_webhook_event_{$event_type}Action3.16.0Fires after Sugar Calendar Events handles a Google Calendar webhook event. Passes the webhook payload.
sugar_calendar_integrations_elementor_loop_grid_query_argsFilter3.10.0Changes the event query for the Elementor Loop Grid widget.
sugar_calendar_ai_assistant_enabledFilter3.15.0Return false to turn off the Gia AI assistant site-wide. To learn more, see our guide to using Gia AI.
sugar_calendar_abilities_registerFilter3.13.0Adds or changes the abilities Sugar Calendar Events offers to AI assistants. To learn more, see our guide to using Sugar Calendar Events with AI assistants.

Legacy Hooks

These hooks belong to Sugar Calendar’s older calendar and event list shortcodes and widgets. They still work, but they don’t run for the Calendar and Event List blocks. For new projects, use the hooks in the sections above.

HookTypeWhat it does
sc_before_calendarActionFires before the legacy calendar output.
sc_after_calendarActionFires after the legacy calendar output.
sc_before_events_listActionFires before the legacy events list.
sc_after_events_listActionFires after the legacy events list.
sc_before_event_list_itemActionFires before each item in the legacy events list. Passes the event ID.
sc_after_event_list_itemActionFires after each item in the legacy events list. Passes the event ID.
sc_before_calendar_widgetActionFires before the calendar widget.
sc_after_calendar_widgetActionFires after the calendar widget.
sc_before_event_list_widgetActionFires before the event list widget.
sc_after_event_list_widgetActionFires after the event list widget.
sc_before_category_widgetActionFires before the event categories widget.
sc_after_category_widgetActionFires after the event categories widget.
sc_before_filter_widgetActionFires before the event filter widget.
sc_after_filter_widgetActionFires after the event filter widget.
sc_event_calendar_linkFilterChanges an event’s link inside the legacy calendar.
sugar_calendar_legacy_event_list_linkFilterChanges an event’s link in the legacy events list. Passes the link and $event.

Examples

Here are a few common customizations to get you started.

Add a Row to the Event Details

This snippet adds a Dress code row after the location on single event pages. Priority 42 places it between the location (40) and link (45) rows.

add_action( 'sugar_calendar_frontend_event_details', function ( $event ) {
	echo '<div class="sc-frontend-single-event__details-row">';
	echo '<div class="sc-frontend-single-event__details__label">Dress code:</div>';
	echo '<div class="sc-frontend-single-event__details__val">Smart casual</div>';
	echo '</div>';
}, 42 );

Change the Email From Name

This snippet changes the From name on emails Sugar Calendar Events sends.

add_filter( 'sc_email_from_name', function ( $name ) {
	return 'Sullie\'s Flowers Events';
} );

Run Code When a Ticket Order Completes

This snippet runs after Sugar Calendar Events saves a ticket order, for example, to send the order to another system.

add_action( 'sc_et_checkout_complete', function ( $payload, $order_id ) {
	error_log( 'Sugar Calendar order completed: ' . $order_id );
}, 10, 2 );

That’s it! You now know how to use the hooks in Sugar Calendar Events to customize your events.

Next, would you like to change how your event archive and single event pages look? Be sure to check out our tutorial on customizing template files to learn how.