Title: get_date_sql
Published: April 25, 2014
Last modified: February 24, 2026

---

# apply_filters( ‘get_date_sql’, string $where, WP_Date_Query $query )

## In this article

 * [Parameters](https://developer.wordpress.org/reference/hooks/get_date_sql/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/hooks/get_date_sql/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/hooks/get_date_sql/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/hooks/get_date_sql/?output_format=md#changelog)

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

Filters the date query WHERE clause.

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

 `$where`string

WHERE clause of the date query.

`$query`[WP_Date_Query](https://developer.wordpress.org/reference/classes/wp_date_query/)

The [WP_Date_Query](https://developer.wordpress.org/reference/classes/wp_date_query/)
instance.

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

    ```php
    return apply_filters( 'get_date_sql', $where, $this );
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/class-wp-date-query.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/class-wp-date-query.php#L578)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/class-wp-date-query.php#L578-L578)

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

| Used by | Description | 
| [WP_Date_Query::get_sql()](https://developer.wordpress.org/reference/classes/wp_date_query/get_sql/)`wp-includes/class-wp-date-query.php` |

Generates WHERE clause to be appended to a main query.

  |

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

| Version | Description | 
| [3.7.0](https://developer.wordpress.org/reference/since/3.7.0/) | Introduced. |

## User Contributed Notes

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