wp-includes/general-template.php:2477Displays calendar with days that have posts as links.
$argsarrayoptionalarray()$initialbooldefault: true
$displaybooldefault: true
$post_typestringdefault: 'post'
void|string3 hooks fire while get_calendar() runs, in this order:
Filter the `get_calendar` function arguments before they are used.
function get_calendar( $args = array() ) { global $wpdb, $m, $monthnum, $year, $wp_locale, $posts; $defaults = array( 'initial' => true, 'display' => true, 'post_type' => 'post', ); $original_args = func_get_args(); $args = array(); if ( ! empty( $original_args ) ) { if ( ! is_array( $original_args[0] ) ) { if ( isset( $original_args[0] ) && is_bool( $original_args[0] ) ) { $defaults['initial'] = $original_args[0]; } if ( isset( $original_args[1] ) && is_bool( $original_args[1] ) ) { $defaults['display'] = $original_args[1]; } } else { $args = $original_args[0]; } } /** * Filter the `get_calendar` function arguments before they are used. * * @since 6.8.0 * * @param array $args { * Optional. Arguments for the `get_calendar` function. * * @type bool $initial Whether to use initial calendar names. Default true. * @type bool $display Whether to display the calendar output. Default true. * @type string $post_type Optional. Post type. Default 'post'. * } */ $args = apply_filters( 'get_calendar_args', wp_parse_args( $args, $defaults ) ); if ( ! post_type_exists( $args['post_type'] ) ) { $args['post_type'] = 'post'; } $w = 0; if ( isset( $_GET['w'] ) ) { $w = (int) $_GET['w']; } /* * Normalize the cache key. * * The following ensures the same cache key is used for the same parameter * and parameter equivalents. This prevents `post_type > post, initial > true` * from generating a different key from the same values in the reverse order. * * `display` is excluded from the cache key as the cache contains the same * HTML regardless of this function's need to echo or return the output. * * The global values contain data generated by the URL query string variables. */ $cache_args = $args; unset( $cache_args['display'] ); $cache_args['globals'] = array( 'm' => $m, 'monthnum' => $monthnum, 'year' => $year, 'week' => $w, ); wp_recursive_ksort( $cache_args ); $key = md5( serialize( $cache_args ) ); $cache = wp_cache_get( 'get_calendar', 'calendar' ); if ( $cache && is_array( $cache ) && isset( $cache[ $key ] ) ) { /** This filter is documented in wp-includes/general-template.php */ $output = apply_filters( 'get_calendar', $cache[ $key ], $args ); if ( $args['display'] ) {Introduced in 1.0.0. 3 changes between 6.7.7 and 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
$args added.verified against source$initial removed.verified against source$display removed.verified against sourcesrc/wp-includes/general-template.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.