You can use $_GET to get the query string values and then pass it in the $args to create a dynamic WP_Query
$after = $_GET['after'];
$before = $_GET['before'];
and then in the $args
if ($after && $before) {
$args = array(
'date_query' => array(
array(
'after' => $after,
'before' => $before,
'inclusive' => true,
),
),
);
} else {
// default args
}
$query = new WP_Query( $args );
Related Posts:
- Keep getting same permalink with WP_Query?
- Should we trust the post globals?
- Get first post from wp_query
- Querying post from a multisite network
- How to query serialized array by comparing greater than (>=)?
- How to know if get_posts() failed?
- Show related posts by category but ignore one category
- post__in for get_posts with a dynamic array
- Query posts distinct authors
- Post content being duplicated by the_content();
- Specific loop in Shortcode
- Sort posts by activity date
- Navigation link to specific user page
- How to add padding between posts
- Working Bootstrap Carousel Conversion to WP – Technical Questions
- Link for the page archive for posts, like using custom post types with get_post_type_archive_link
- Search widget breaks when using multiple loops?
- How to change bulk post status
- Add few specific post ids to wp_query
- Link button is not working while editing a post in Firefox [closed]
- WP_Query posts_per_page ignored
- wp_query ‘s’ parameter does not work with custom post type
- WP Query related posts by current page Tag ID
- WP_Query get posts from custom posts by category
- Accessing post->ID outside of the loop for listing child pages
- WP Query – duplicated posts once including tags in search results
- List posts in a given category
- Reset Popular post query?
- Query Posts multiple conditions
- how to get posts ids inside pre_get_posts filter?
- Future post ID not showing
- How do I use WP_Query to get a range of posts with custom fields that have numbers with letters in them?
- recent posts for different categories
- Search by post title and content in wp_query without order
- Change post order random through out the entire WordPress
- Setup a custom dynamic post
- Anyway to grab author name and featured image in an embeded in inital array of posts outside of loop?
- Removing noindex posts from wp_query
- How to Next and Prevous Navigation Buttons on the end of the page with custom image Using Wp Post Navigation Plugin
- How safe is renovating $wp_query when doing WP_Query pagination in Page Template
- Exclude the first ‘n’ number of posts of a tag from home page?
- wp_posts table: safely remove unused columns to save database storage
- Using wp_list_pages() after calling query_posts()
- how to get post order by post id wp_query?
- How to display all posts divided/ordered by post date? [closed]
- Why are my paginated posts always returning the same results?
- Is it possible to use WP_Query to only pull posts with attachments?
- Inner join overrides Advanced Custom Fields plugin’s get_field [closed]
- Query posts by Author and/or by Tag
- Can’t understand why sometimes a [caption] field appears
- Why in my query is display two title?
- Migrate posts from category and sub-category via SQL
- wp_query with ajax
- Exclude some posts from displaying in wp_query based on some condition
- How to make Link to go on the first post
- How to convert query sql to shortcode in wordpress?
- Use posts_where to exclude posts ids from wp_query
- Current and next month posts
- Why does WordPress search returns same number of results for every search query?
- Sidebar limiting to 10 posts?
- Short link to read complete post
- Delete all Tag Links from Posts
- How to link post titles on page A to its posts on page B?
- Override WordPress core post-template.php block template
- WP_Query outputs wrong post in custom post type
- how to show comments only author which send own posts in wordpress
- Change Old WordPress Post Date Year
- Add data attribute of post_id for Internal links
- Prevent the automatic URL linking added in last update
- Display/Filter post using if else statement
- How to sort WP_Post Object array by object field in php?
- Search results for ACF data
- How do I remove all links from all my posts at once?
- Query prints posts without specific categories
- Numbered Pagination Showing The Same Posts After Altering WP_Query
- Order by meta_key field in WordPress not meta_value field value
- How to create page with post content in it?
- How to remove a post from results by ID after query?
- Creating a link to the first post in a category
- Override wp_link_pages pagebreak with filter
- Loop through all posts showing duplicates
- WP_Query extended with AJAX
- Manipulate query to show specific post
- WordPress text field in array problem
- Random order of the 5 most popular posts
- My custom query is displaying random posts in random order
- Get query result according to merged array
- Sort / Filter Queries
- How to show the posts list into a static page? Problems to use the loop into a static page
- How do I control the fallback query after the original query returned cero posts?
- Displaying Results From Custom Taxonomy Query
- Multiple loops on a Search result page?
- What is wrong with this wp_query?
- WP_Query: Fetch posts that are in (category1 and not in category2), OR posts that are not in cagegory1
- Exclude sub sub categories from displaying in the archive page
- How do I show the post title if an advanced custom field hasn’t been used?
- How add class the_content();?
- Automatically search and replace link in content (pages/posts)?
- Get related posts matching most of the provided tags using WP_Query
- WP_Query post_tilte search in posts table