WP_Date_Query Generator

Overview

Use this tool to create custom code for WordPress Date Query with WP_Date_Query class.

Usage

  • Fill in the user-friendly form.
  • Click the “Update Code” button.
  • Copy the code to your project.
  • Or save it as a snippet and share with the community.

Examples

If you are still learning how to use this tool, check out the following examples:

The variable used in the code.
The MySQL keyword used to join the clauses of the query.
Operator used for comparing the value.
Textual date/time description.
Select from your saved Date Query snippets.
Comparing column other than the one in the top-level column.
Textual date/time description.
Include results from dates specified, or not.
Operator used for comparing the value.
Textual date/time description.
Select from your saved Date Query snippets.
Comparing column other than the one in the top-level column.
Textual date/time description.
Include results from dates specified, or not.
Operator used for comparing the value.
Textual date/time description.
Select from your saved Date Query snippets.
Comparing column other than the one in the top-level column.
Textual date/time description.
Include results from dates specified, or not.
Operator used for comparing the value.
Textual date/time description.
Select from your saved Date Query snippets.
Comparing column other than the one in the top-level column.
Textual date/time description.
Include results from dates specified, or not.
Operator used for comparing the value.
Textual date/time description.
Select from your saved Date Query snippets.
Comparing column other than the one in the top-level column.
Textual date/time description.
Include results from dates specified, or not.
  Save Snippet
$date_query = array(
	'relation' => 'OR',
	array(
		'year'          => 2018,
		'month'         => 08,
		'day'           => 01,
		'compare'       => '>=',
		'column'        => 'post_date',
	),
);