Filter the get_calendar function arguments before they are used.
Parameters
$argsarray- Arguments for the
get_calendarfunction.
initialboolWhether to use initial calendar names. Default true.displayboolWhether to display the calendar output. Default true.post_typestringOptional. Post type. Default'post'.
Source
$args = apply_filters( 'get_calendar_args', wp_parse_args( $args, $defaults ) );
Changelog
| Version | Description |
|---|---|
| 6.8.0 | Introduced. |
The
get_calendar_argsfilter allows you to modify the arguments passed to theget_calendar()function before the calendar is built. This is useful for changing the post type used, disabling the initial calendar names, or overriding other default options.Example: Display calendar using a custom post type
Example: Disable initial calendar names (month headings)
This filter is helpful when integrating custom post types (like events or courses) into your theme’s calendar, or when you want to control display behavior globally without modifying every
get_calendar()call.