Title: get_calendar
Published: April 25, 2014
Last modified: May 20, 2026

---

# apply_filters( ‘get_calendar’, string $calendar_output, array $args )

## In this article

 * [Parameters](https://developer.wordpress.org/reference/hooks/get_calendar/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/hooks/get_calendar/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/hooks/get_calendar/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/hooks/get_calendar/?output_format=md#changelog)
 * [User Contributed Notes](https://developer.wordpress.org/reference/hooks/get_calendar/?output_format=md#user-contributed-notes)

[ Back to top](https://developer.wordpress.org/reference/hooks/get_calendar/?output_format=md#wp--skip-link--target)

Filters the HTML calendar output.

## 󠀁[Parameters](https://developer.wordpress.org/reference/hooks/get_calendar/?output_format=md#parameters)󠁿

 `$calendar_output`string

HTML output of the calendar.

`$args`array

Array of display arguments.

 * `initial` bool
 * Whether to use initial calendar names. Default true.
 * `display` bool
 * Whether to display the calendar output. Default true.
 * `post_type` string
 * Optional. Post type. Default `'post'`.

## 󠀁[Source](https://developer.wordpress.org/reference/hooks/get_calendar/?output_format=md#source)󠁿

    ```php
    $calendar_output = apply_filters( 'get_calendar', $calendar_output, $args );
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/general-template.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-includes/general-template.php#L2604)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/general-template.php#L2604-L2604)

## 󠀁[Related](https://developer.wordpress.org/reference/hooks/get_calendar/?output_format=md#related)󠁿

| Used by | Description | 
| [get_calendar()](https://developer.wordpress.org/reference/functions/get_calendar/)`wp-includes/general-template.php` |

Displays calendar with days that have posts as links.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/hooks/get_calendar/?output_format=md#changelog)󠁿

| Version | Description | 
| [6.8.0](https://developer.wordpress.org/reference/since/6.8.0/) | Added the `$args` parameter. | 
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |

## 󠀁[User Contributed Notes](https://developer.wordpress.org/reference/hooks/get_calendar/?output_format=md#user-contributed-notes)󠁿

 1.  [Skip to note 2 content](https://developer.wordpress.org/reference/hooks/get_calendar/?output_format=md#comment-content-7345)
 2.   [Md Abul Bashar](https://profiles.wordpress.org/hmbashar/)  [  1 year ago  ](https://developer.wordpress.org/reference/hooks/get_calendar/#comment-7345)
 3. [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fget_calendar%2F%23comment-7345)
    Vote results for this note: 0[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fget_calendar%2F%23comment-7345)
 4. The `get_calendar` filter lets you customize the HTML output of the calendar generated
    by `get_calendar()`. This is useful for wrapping the calendar in a custom container
    or adding extra classes for styling.
 5. **Example:** Add a wrapper `<div>` around the calendar output
 6.     ```php
        add_filter( 'get_calendar', function( $calendar_output ) {
            return '<div class="custom-calendar-wrapper">' . $calendar_output . '</div>';
        } );
        ```
    
 7. You can also use the `$args` array to conditionally modify the output based on 
    post type, calendar visibility, or display preference.
 8.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fget_calendar%2F%3Freplytocom%3D7345%23feedback-editor-7345)

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fget_calendar%2F)
before being able to contribute a note or feedback.