General Relation Date 1 Date 2 Date 3 Date 4 Date 5 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: Single date parameter Multiple date parameters Range of dates Textual description range Nested date queries Query Variable Name The variable used in the code. Date Relation Choose... AND (default) OR The MySQL keyword used to join the clauses of the query. Date Type Date Parameters Before/After String Before/After Array Nested Date Query Year Month Day Compare Choose... = (Default) != > >= < <= IN NOT IN BETWEEN NOT BETWEEN Operator used for comparing the value. Before Text Textual date/time description. Before Year Before Month Before Day Date Query No save snippets... Select from your saved Date Query snippets. Week Day of Week Day of Week (iso) Column Choose... post_date post_date_gmt post_modified post_modified_gmt comment_date comment_date_gmt Comparing column other than the one in the top-level column. After Text Textual date/time description. After Year After Month After Day Hour Minute Second Inclusive Choose... Yes - Default No Include results from dates specified, or not. Date Type Date Parameters Before/After String Before/After Array Nested Date Query Year Month Day Compare Choose... = (Default) != > >= < <= IN NOT IN BETWEEN NOT BETWEEN Operator used for comparing the value. Before Text Textual date/time description. Before Year Before Month Before Day Date Query No save snippets... Select from your saved Date Query snippets. Week Day of Week Day of Week (iso) Column Choose... post_date post_date_gmt post_modified post_modified_gmt comment_date comment_date_gmt Comparing column other than the one in the top-level column. After Text Textual date/time description. After Year After Month After Day Hour Minute Second Inclusive Choose... Yes - Default No Include results from dates specified, or not. Date Type Date Parameters Before/After String Before/After Array Nested Date Query Year Month Day Compare Choose... = (Default) != > >= < <= IN NOT IN BETWEEN NOT BETWEEN Operator used for comparing the value. Before Text Textual date/time description. Before Year Before Month Before Day Date Query No save snippets... Select from your saved Date Query snippets. Week Day of Week Day of Week (iso) Column Choose... post_date post_date_gmt post_modified post_modified_gmt comment_date comment_date_gmt Comparing column other than the one in the top-level column. After Text Textual date/time description. After Year After Month After Day Hour Minute Second Inclusive Choose... Yes - Default No Include results from dates specified, or not. Date Type Date Parameters Before/After String Before/After Array Nested Date Query Year Month Day Compare Choose... = (Default) != > >= < <= IN NOT IN BETWEEN NOT BETWEEN Operator used for comparing the value. Before Text Textual date/time description. Before Year Before Month Before Day Date Query No save snippets... Select from your saved Date Query snippets. Week Day of Week Day of Week (iso) Column Choose... post_date post_date_gmt post_modified post_modified_gmt comment_date comment_date_gmt Comparing column other than the one in the top-level column. After Text Textual date/time description. After Year After Month After Day Hour Minute Second Inclusive Choose... Yes - Default No Include results from dates specified, or not. Date Type Date Parameters Before/After String Before/After Array Nested Date Query Year Month Day Compare Choose... = (Default) != > >= < <= IN NOT IN BETWEEN NOT BETWEEN Operator used for comparing the value. Before Text Textual date/time description. Before Year Before Month Before Day Date Query No save snippets... Select from your saved Date Query snippets. Week Day of Week Day of Week (iso) Column Choose... post_date post_date_gmt post_modified post_modified_gmt comment_date comment_date_gmt Comparing column other than the one in the top-level column. After Text Textual date/time description. After Year After Month After Day Hour Minute Second Inclusive Choose... Yes - Default No Include results from dates specified, or not. Update Code Save Snippet
$date_query = array( 'relation' => 'AND', array( 'after' => '1 year ago', ), array( 'dayofweek' => 1, 'compare' => '!=', ), );