Skip to content
GravityKit
Buy
Sign in
0 items

GravityKit All Access

Perform advanced calculations on your form data. Display the number of form submissions, build calculators, and much more.

  • GravityView

    GravityView

    Bestseller

    Display Gravity Forms entries on the front-end of your site and build powerful web applications.

  • GravityImport

    GravityImport

    Trending

    Import entries from CSV files into Gravity Forms to transfer data, create new forms, or update existing entries.

  • GravityEdit

    GravityEdit

    Quickly edit Gravity Forms entries inline to save time, reduce clicks, and streamline your workflow.

  • GravityCharts

    GravityCharts

    Trending

    Turn Gravity Forms entries into interactive charts and graphs.

  • GravityActions

    GravityActions

    Update multiple Gravity Forms entries at once, send bulk emails, and streamline your workflow.

  • GravityCalendar

    GravityCalendar

    Turn Gravity Forms entries into dynamic calendars to showcase events, schedules, appointments, and more.

  • GravityExport

    GravityExport

    Export Gravity Forms entries to Excel, CSV, or PDF and share them instantly with secure download links.

  • GravityMath

    GravityMath

    Perform advanced calculations on Gravity Forms entries to display totals, averages, or build custom calculators.

  • GravityRevisions

    GravityRevisions

    Track, compare, and restore changes made to Gravity Forms forms and entries with a full version history.

  • GravityMigrate

    GravityMigrate

    Migrate all Gravity Forms data, including forms, entries, Views, feeds, uploads, and more.

  • GravityBoard

    GravityBoard

    Manage projects with collaborative project management. Coordinate with your team and streamline your workflows.

Use cases

  • Nonprofits
  • Startups
  • Education
  • Web Agencies
  • Developers
  • Government iconGovernment

Case studies

  • Princeton University
  • BrightLeaf Giving
  • Jacksonville Port Authority
  • National Severe Storms Lab
  • Leadpal
  • Mediebruket
  • Dragonfly
  • HappyTree It
View All Case Studies

  • Blog
  • Case studies
  • Support
  • Live Demos
  • Documentation ↗
  • Developer docs ↗
  • GravityKit Academy ↗
  • GravityKit Live!

Build-it guides

  • Member Directory
  • Company Intranet
  • Fundraising Dashboard
  • Real Estate Directory
  • Document Library
  • Academic Journal
  • Volunteer Management
  • Meal Tracker
  • Simple CRM System
View All Guides
  • Pricing
  • About
  • Plugins

    GravityKit All Access

    Our complete Kit of essential tools for extending and enhancing Gravity Forms—everything you need to build powerful web apps and workflows.

    Learn more
    • GravityView

      GravityView

      Bestseller

      Display Gravity Forms entries on the front-end of your site and build powerful web applications.

    • GravityImport

      GravityImport

      Trending

      Import entries from CSV files into Gravity Forms to transfer data, create new forms, or update existing entries.

    • GravityEdit

      GravityEdit

      Quickly edit Gravity Forms entries inline to save time, reduce clicks, and streamline your workflow.

    • GravityCharts

      GravityCharts

      Trending

      Turn Gravity Forms entries into interactive charts and graphs.

    • GravityActions

      GravityActions

      Update multiple Gravity Forms entries at once, send bulk emails, and streamline your workflow.

    • GravityCalendar

      GravityCalendar

      Turn Gravity Forms entries into dynamic calendars to showcase events, schedules, appointments, and more.

    • GravityExport

      GravityExport

      Export Gravity Forms entries to Excel, CSV, or PDF and share them instantly with secure download links.

    • GravityMath

      GravityMath

      Perform advanced calculations on Gravity Forms entries to display totals, averages, or build custom calculators.

    • GravityRevisions

      GravityRevisions

      Track, compare, and restore changes made to Gravity Forms forms and entries with a full version history.

    • GravityMigrate

      GravityMigrate

      Migrate all Gravity Forms data, including forms, entries, Views, feeds, uploads, and more.

    • GravityBoard

      GravityBoard

      Manage projects with collaborative project management. Coordinate with your team and streamline your workflows.

  • Ideal For

    • Nonprofits
    • Startups
    • Education
    • Web Agencies
    • Developers
    • Government iconGovernment

    Case studies

    • Princeton University
    • BrightLeaf Giving
    • Jacksonville Port Authority
    • National Severe Storms Lab
    • Leadpal
    • Mediebruket
    • Dragonfly
    • HappyTree It
    View All Case Studies

    How to build...

    • Member Directory
    • Company Intranet
    • Fundraising Dashboard
    • Real Estate Directory
    • Document Library
    • Academic Journal
    • Volunteer Management
    • Meal Tracker
    • Simple CRM System
    View All Guides
  • Resources

    • Blog
    • Case studies
    • Support
    • Live Demos
    • Documentation ↗
    • Developer docs ↗
    • GravityKit Academy ↗
    • GravityKit Live!

    Build-it guides

    • Member Directory
    • Company Intranet
    • Fundraising Dashboard
    • Real Estate Directory
    • Document Library
    • Academic Journal
    • Volunteer Management
    • Meal Tracker
    • Simple CRM System
    View All Guides
  • Pricing
  • About
0 items

Search

Results appear automatically as you type.
Loading results…

results found matching

    Sign in
    Buy

    Docs

    • Docs Home

    Gravity Forms Add-Ons

    • GravityView
    • GravityBoard
    • GravityImport
    • GravityEdit
    • GravityExport
    • GravityExport Lite
    • GravityMath
    • GravityCalendar
    • GravityCharts
    • GravityActions
    • GravityRevisions
    • GravityMigrate
    • GF Dynamic Lookup
    • GF Entry Tags
    • GF Event Field
    • GF Widget for Elementor
    • GF Zero Spam

    GravityView

    • Getting Started
    • View Setup
    • FAQ
    • Pre-Sale
    • Advanced
    • Common Problems
    • Customizing Your Views
    • Edit Entry
    • Entry Approval
    • Filter and Sort Results
    • Gravity Forms
    • Merge Tags
    • Roles and Capabilities
    • Search
    • Shortcodes
    • View Settings
    • WordPress Posts

    General Help

    • Account, Invoices, and Billing
    • License Related
    • Plugins and Settings
    • Contact
    • Docs Home
    • Gravity Forms Add-Ons

      • GravityView
      • GravityBoard
      • GravityImport
      • GravityEdit
      • GravityExport
      • GravityExport Lite
      • GravityMath
      • GravityCalendar
      • GravityCharts
      • GravityActions
      • GravityRevisions
      • GravityMigrate
      • GF Dynamic Lookup
      • GF Entry Tags
      • GF Event Field
      • GF Widget for Elementor
      • GF Zero Spam
    • GravityView

      • Getting Started
      • View Setup
      • FAQ
      • Pre-Sale
      • Advanced
      • Common Problems
      • Customizing Your Views
      • Edit Entry
      • Entry Approval
      • Filter and Sort Results
      • Gravity Forms
      • Merge Tags
      • Roles and Capabilities
      • Search
      • Shortcodes
      • View Settings
      • WordPress Posts
    • General Help

      • Account, Invoices, and Billing
      • License Related
      • Plugins and Settings
    • Contact

    GravityCalendar

    • Add a GravityCalendar to Apple Calendar
    • Add a GravityCalendar to Google Calendar
    • Adding custom CSS to your Views
    • Attaching an event into a notification
    • Calendar Blocks
    • Calendar Setting: “No Current Events Behavior”
    • Calendar Shortcodes
    • Calendar: Developer Hooks
    • Can I book an appointment with GravityCalendar?
    • Creating recurring events in Gravity Forms
    • Displaying a calendar
    • Displaying events from another calendar with GravityCalendar
    • Event Field events are showing as all-day in GravityCalendar
    • Getting Started with GravityCalendar
    • GravityCalendar – Customizing event colors
    • How can I change the day weeks start on in Calendar?
    • How to download or subscribe to just one single event
    • How to enable repeating events
    • How to process shortcodes contained within fields used by the Calendar
    • How to remove the all-day text in the calendar list layout
    • I can’t see GravityCalendar settings or create a calendar
    • My calendar or events aren’t displaying
    • Pre-selecting a calendar date using URL parameters
    • The difference between subscribing to a calendar and downloading calendar events
    • Working with timezones in GravityCalendar
    • Home
    • Docs
    • GravityCalendar
    • Pre-selecting a calendar date using URL parameters

    Pre-selecting a calendar date using URL parameters

    Estimated reading: 10 minutes

    Updated on April 23, 2026

    Learn how to automatically navigate to a specific date when someone visits your calendar by adding a URL parameter.

    What you’ll learn #

    This guide shows you how to add a code snippet that allows you to pre-select a date on your GravityCalendar using a URL parameter. This is useful for sharing links to specific events or dates.

    Before you begin #

    • You need GravityCalendar installed and activated
    • You should have at least one calendar feed configured

    How it works #

    When someone visits a URL like https://example.com/events/?calendar_date=2025-03-15  , the calendar will automatically open to March 15, 2025.

    Installation #

    1. Copy the snippet
    2. Add it to your site
    /**
     * GravityCalendar - URL Parameter Initial Date Support
     *
     * This snippet allows users to pre-select a calendar date via URL parameter.
     *
     * Usage Examples:
     * - ?calendar_date=2025-03-01
     * - ?calendar_date=2025-03-15
     * - ?calendar_date=2025-12-25
     */
    
    /**
     * The URL parameter name to use for the initial date.
     *
     * Example: If set to 'calendar_date', use ?calendar_date=2025-03-01 in the URL
     * Example: If set to 'start_date', use ?start_date=2025-03-01 in the URL
     */
    define( 'GRAVITYCALENDAR_DATE_URL_PARAM', 'calendar_date' );
    
    add_filter( 'gravityview/calendar/options', 'gravitycalendar_add_initial_date_from_url', 10, 3 );
    add_filter( 'gravityview/calendar/extra_options', 'gravitycalendar_set_navigate_to_current_from_url', 10, 3 );
    
    /**
     * Get and validate date from URL parameter.
     *
     * This helper function extracts the date from the URL, validates the format,
     * and ensures it's a real date. Returns the validated date string or false.
     *
     * @since TBD
     *
     * @return string|false The validated date string (YYYY-MM-DD) or false if invalid/missing.
     */
    function gravitycalendar_get_date_from_url() {
    
    	/**
    	 * Check if the URL has our date parameter.
    	 */
    	$url_param_name = GRAVITYCALENDAR_DATE_URL_PARAM;
    
    	// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Reading URL parameter for display only.
    	if ( ! isset( $_GET[ $url_param_name ] ) ) {
    		return false;
    	}
    
    	/**
    	 * Get the date from the URL and clean it up for security.
    	 */
    	// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Reading URL parameter for display only.
    	$user_provided_date = sanitize_text_field( wp_unslash( $_GET[ $url_param_name ] ) );
    
    	/**
    	 * Check if the date format is correct (YYYY-MM-DD).
    	 *
    	 * Example: '2025-03-01' is valid, '03/01/2025' is not.
    	 */
    	$is_valid_format = preg_match( '/^\d{4}-\d{2}-\d{2}$/', $user_provided_date );
    
    	if ( ! $is_valid_format ) {
    		GV_Extension_Calendar_Feed::logger()->error(
    			sprintf(
    				'Invalid date format in URL parameter "%s". Expected YYYY-MM-DD, got: %s',
    				$url_param_name,
    				$user_provided_date
    			)
    		);
    
    		return false;
    	}
    
    	/**
    	 * Check if the date is actually real.
    	 *
    	 * Example: '2025-03-01' is real, '2025-13-45' is not (no 13th month or 45th day).
    	 */
    	list( $year, $month, $day ) = explode( '-', $user_provided_date );
    
    	$is_real_date = checkdate( (int) $month, (int) $day, (int) $year );
    
    	if ( ! $is_real_date ) {
    		GV_Extension_Calendar_Feed::logger()->error(
    			sprintf(
    				'Invalid date in URL parameter "%s": %s (this date does not exist)',
    				$url_param_name,
    				$user_provided_date
    			)
    		);
    
    		return false;
    	}
    
    	return $user_provided_date;
    }
    
    /**
     * Add initialDate to calendar options based on URL parameter.
     *
     * This function checks if a date is provided in the URL and, if valid,
     * sets it as the initial date for the calendar to display.
     *
     * @since TBD
     *
     * @param array $calendar_options The calendar configuration options passed to FullCalendar.
     * @param int   $form_id          The form ID.
     * @param int   $feed_id          The calendar feed ID.
     *
     * @return array Modified calendar options with initialDate if valid URL parameter exists.
     */
    function gravitycalendar_add_initial_date_from_url( $calendar_options, $form_id, $feed_id ) {
    
    	$date = gravitycalendar_get_date_from_url();
    
    	if ( false === $date ) {
    		return $calendar_options;
    	}
    
    	$calendar_options['initialDate'] = $date;
    
    	return $calendar_options;
    }
    
    /**
     * Set navigateToEvents to "current" when URL date parameter is present.
     *
     * When a user provides a specific date in the URL, we want the calendar to stay
     * on that date rather than automatically navigating to past or future events.
     * This overrides the "No Current Events Behavior" setting to "Stay on Today".
     *
     * @since TBD
     *
     * @param array $extra_options Extra calendar options (not standard FullCalendar options).
     * @param int   $form_id       The form ID.
     * @param int   $feed_id       The calendar feed ID.
     *
     * @return array Modified extra options with navigateToEvents set to 'current'.
     */
    function gravitycalendar_set_navigate_to_current_from_url( $extra_options, $form_id, $feed_id ) {
    
    	$date = gravitycalendar_get_date_from_url();
    
    	if ( false === $date ) {
    		return $extra_options;
    	}
    
    	/**
    	 * URL parameter exists, so set navigateToEvents to 'current'.
    	 *
    	 * This means "Stay on Today (Show Current Calendar)" and prevents the calendar
    	 * from automatically jumping to past or future events when there are no events
    	 * in the current view.
    	 */
    	$extra_options['navigateToEvents'] = 'current';
    
    	return $extra_options;
    }

    Usage #

    Basic example

    Share this URL with your users:

    https://example.com/calendar-page/?calendar_date=2025-03-15  

    The calendar will automatically display March 15, 2025 when loaded.

    Date format requirements

    The date must be in ISO 8601 format: YYYY-MM-DD  

    Valid examples:

    • ?calendar_date=2025-01-01   (January 1, 2025)
    • ?calendar_date=2025-12-31   (December 31, 2025)
    • ?calendar_date=2026-06-15   (June 15, 2026)

    Invalid examples:

    • ?calendar_date=03/15/2025   (US format – not supported)
    • ?calendar_date=15-03-2025   (European format – not supported)
    • ?calendar_date=2025-13-45   (Invalid date – no 13th month)

    Multiple calendars on one page

    The URL parameter will affect all calendars on the page. If you need different behavior for specific calendars, you can modify the snippet to check the $feed_id   parameter:

    function gravitycalendar_add_initial_date_from_url( $calendar_options, $form_id, $feed_id ) {
        // Only apply to calendar feeds #5 and #12
        $allowed_feeds = array( 5, 12 );
    
        if ( ! in_array( $feed_id, $allowed_feeds, true ) ) {
            return $calendar_options;
        }
    
        // ... rest of the code continues here
    }

    Disabling automatic “Stay on Today” behavior

    By default, when a URL date parameter is present, the snippet automatically sets the Calendar feed’s No Current Events Behavior to “Stay on Today (Show Current Calendar)”.

    If you want to keep your calendar’s configured No Current Events Behavior setting, remove this line from the snippet:

    add_filter( 'gravityview/calendar/extra_options', 'gravitycalendar_set_navigate_to_current_from_url', 10, 3 );

    And delete the gravitycalendar_set_navigate_to_current_from_url  function at the bottom of the snippet.

    Customization #

    Changing the URL parameter name

    By default, the snippet uses calendar_date   as the URL parameter. To use a different parameter name:

    1. Open the snippet file or your functions.php
    2. Find this line near the top:

    define( 'GRAVITYCALENDAR_DATE_URL_PARAM', 'calendar_date' );  

    1. Change 'calendar_date'   to your preferred parameter name:

    define( 'GRAVITYCALENDAR_DATE_URL_PARAM', 'start_date' );  

    1. Save the file
    2. Your URLs will now use the new parameter:

    https://example.com/events/?start_date=2025-03-15  

    Common customizations

    Use “date” as the parameter:

    define( 'GRAVITYCALENDAR_DATE_URL_PARAM', 'date' ); // URL: ?date=2025-03-15

    Use “event_date” as the parameter:

    define( 'GRAVITYCALENDAR_DATE_URL_PARAM', 'event_date' ); // URL: ?event_date=2025-03-15

    Troubleshooting #

    The calendar doesn’t navigate to the specified date

    Check these common issues:

    1. Date format: Make sure you’re using YYYY-MM-DD   format
    2. Parameter name: Verify the URL parameter matches what’s defined in GRAVITYCALENDAR_DATE_URL_PARAM  
    3. Snippet activation: Confirm the snippet is active and saved correctly
    4. Browser cache: Clear your browser cache and try again

    How to view error logs

    If dates aren’t working, check your error logs:

    1. Enable logging in GravityKit
    2. Look for entries starting with “Invalid date format” or “Invalid date”
    3. The log will show exactly what date was received and why it failed validation

    Related resources #

    • FullCalendar initialDate option
    Still stuck? How can we help?

    How can we help?

    "*" indicates required fields

    This field is for validation purposes and should be left unchanged.
    Replies will go to this email.
    How can we help?*
    My pre-sale question is related to...*
    My WordPress skills are....*
    My Gravity Forms skills are...*
    You will be shown articles from our documentation.
    Vous pouvez nous écrire dans votre langue maternelle si c’est plus facile pour vous—nous nous occuperons de la traduction!
    Puedes escribirnos en tu idioma nativo si te resulta más fácil; ¡nosotros nos encargamos de la traducción!
    Sie können uns in Ihrer Muttersprache schreiben, wenn das für Sie einfacher ist – wir kümmern uns um die Übersetzung!
    U kunt ons in uw moedertaal schrijven als dat gemakkelijker voor u is — wij zorgen voor de vertaling!
    Du kan skrive til oss på ditt morsmål hvis det er enklere for deg — vi tar oss av oversettelsen!
    Du kan skriva till oss på ditt modersmål om det är lättare för dig — vi tar hand om översättningen!
    Você pode nos escrever em seu idioma nativo se for mais fácil para você — nós cuidaremos da tradução!
    Puoi scriverci nella tua lingua madre se ti è più facile — penseremo noi alla traduzione!
    Please provide as much detail as you're able; this helps us provide you with faster support.
    Drop files here or
    Accepted file types: jpg, jpeg, gif, png, tiff, pdf, bmp, zip, json, csv, xls, xlsx, Max. file size: 256 MB.
      Stay informed?

      Was this page helpful?

      Table Of Contents
      • What you’ll learn
      • Before you begin
      • How it works
      • Installation
      • Usage
      • Customization
      • Troubleshooting
      • Related resources
      GravityKit
      • How to Build It
      • Pricing
      • Products
      • Our Team
      • Our Values
      • Work With Us
      • Coupons
      Support
      • Support
      • Contact
      • Documentation
      • Scope of Support
      • Brand Guidelines
      • Privacy Policy
      • Terms of Service (“Terms”)
      About Us
      • GravityKit on Mastodon
      • GravityKit on Twitter
      • GravityKit Training Courses
      • GravityKit on Facebook
      • Join our Facebook Group
      • Facebook
      • Twitter
      Get notified of updates.

      We’re constantly improving GravityKit. Fill out your email below and we’ll notify you anytime major updates drop.

      GravityKit is a Gravity Forms Certified Developer.

      Copyright © 2026, Katz Web Services, Inc.

      GravityKit and GravityView are registered trademarks of Katz Web Services, Inc.