If you’d prefer to change the default protocol of the Subscribe to Calendar‘s iCal option, you can do so with a quick customization.
By default, these links are generated with the webcal:// protocol, which is designed for live iCalendar subscriptions. If instead you’d like the link to use https:// (so it downloads the .ics file directly rather than subscribing), you can override that default with a small code snippet.
The Filter to Use
Add the following snippet to your site:
add_filter( 'tec_views_v2_subscribe_links_feed_url', 'tec_modify_ical_to_https' );
function tec_modify_ical_to_https( $link ) {
return str_replace( 'webcal://', 'https://', $link );
}
This filter updates the URL output in the Subscribe to calendar option, replacing any webcal:// reference with https://
How to Add the Snippet
There are two common ways to add custom snippets to your WordPress site:
Add to Your Theme’s functions.php
- In your WordPress dashboard, go to Appearance → Theme File Editor.
- Select your active theme.
- Open the
functions.phpfile. - Paste the snippet above at the bottom of the file, then click Update File.
Use a Code Snippet Plugin
If you prefer to keep custom code separate from your theme, you can install the free Code Snippets plugin. This plugin provides a clean interface to add, manage, and safely enable or disable custom code.
Best Practices
Before adding any custom code, we recommend reading our guide on best practices for implementing custom code snippets. This will help ensure your site remains stable and easy to maintain.
Final Steps
After adding the snippet, clear any caching layers (plugin cache, server cache, or CDN cache) to make sure the new link updates correctly. Then, check your event page to confirm that the iCal link now uses https://.