Personally, I’d generate the date in php using the PHP Date
class and then $date->sub(). With a few more lines of code the query will read:
... WHERE post_date >= ".$date." ...
Related Posts:
- modify all posts of a category to “no comments allowed”
- Newer/Older posts links display same posts on every page
- Create Pages from Database
- How to show related posts by category or custom post type?
- How to create posts (not post template) to be displayed on projects page?
- IF statement in a do_shortcode
- Why does using WP_Query inside a shortcode in an elementor page cause the arguments for WP_Query to get malformed?
- get_template_part for custom post type content not working
- Loop on front-page.php
- How to get all posts except for one post from a certain custom post type?
- Deleting Custom Post type data using mySQL command
- wpdb custom post_type problem
- Adding custom tables to WordPress
- How i can add ‘N’ page of ‘N’ pages under posts loop?
- I would like to have different styles for my posts based on the content of each post
- List custom taxonomy specific to one custom post type
- Store CPT ‘Reviews’ average ratings to a WordPress DB table or to a DB custom table?
- Is it possible to store Custom Post Type data in separate set of tables and still have wp_post class functionality?
- How to import a custom MySQL DB table into a WordPress custom post type
- Shortcode not working with post counter
- Conditional for a Single Post That Belongs to a Category?
- How to Make infinite loop of post
- WP_Query with custom post type ID
- display posts of custom post type with custom taxonomy
- Get post format
- Custom wordpress loop
- displaying content of custom post type
- Posts are not rendering perfectly [closed]
- Display post from custom post type
- Use post in multiple places on a page with multiple posts
- The loop does not show users
- How to fetch posts that are stored in the different table than (default) wp_posts?
- If/Else child list for Custom Post Type single template within loop?
- Right way to store a large set of similar information on website? [duplicate]
- when looping through custom post data not appearing
- Custom post type and custom taxonomy key lenght & query performance
- SEARCH QUERIES – REVERSE OUTPUT
- How can I group by Taxonomy on Custom Post Type while filtering out based on custom Meta
- subtracting the current post form then whole loop, which is generating all CPT titles
- Display title of all custom posts from same taxonomy term on a custom post template
- Custom post Query and WordPress Post Query Clash
- Event Manager: Events Deleted are still in DB as published but hidden in admin
- Post that populates itself (almost) automatically using data from imported excel file
- Populate custom post type/custom fields from an external database
- Only show current category post
- How To Loop Through list with Custom Post Types
- Custom Post Types and Posts are mixed
- How to create content automatically when a post is published?
- Turn post into simple slideshow
- Pulling in a particular post into a single page based on the post id passed into the code
- Styling first post using Advanced Custom Fields
- the_content() stop images being pulled through
- Archive page…limiting posts per page
- Adding custom post type to loop
- How can I add dropdown widget/box to admin post page?
- Custom permalinks – post type – hierarchical taxonomy’s
- Downsides to not using built-in “Posts” post type?
- Get the title of custom post type in another loop
- Custom Taxonomy – Tags Metabox is showing instead of Categories
- How to post twitter like updates on wordpress
- How Can I Set the Post Author of a Post I Just Created With PHP?
- WordPress Orderby Numeric Value Not Working
- Show one item per category of a custom post type
- Storing posts from query and accessing later via AJAX call
- If post has custom field then display css-class
- Multiple Loops On Custom Post Type Template?
- Custom Tag Description unable to display just below and outside of the Loop
- custom post type category count shortcode
- Add post location with mile radius allowing search
- How to integrate a form (Ninja Form or Contact Form 7) with Custom Post Types?
- Custom Post Type within the Loop on Homepage (Page Template)
- Does WP have a global of $id?
- Create new custom post and post category of same name
- Bootstrap accordion looping through posts incorrectly
- Save and user submitted data from a form and display them in the wp backend
- Search Filter CPT, Custom Loop
- Update all published posts at once
- Get post content from another section in custom single page
- Modify Posts from Custom_Post_Type within the plugin
- Create a custom taxonomy template that loops through child categories in term order?
- custom post type: own database table structure and custom “new-post” interface
- Why is the output of a call to the_excerpt different when the call seems to be identical?
- Displaying Posts Using a Custom Query with a Custom Field and a term_id
- Only looping through pages that have children or subpages
- How to sort WP_Query by a custom text field (written as a date dd/mm/yyyy)
- list articles in admin showing nested categories or slugs?
- Show posts from WP Custom Post Type selected from a field in a metabox
- order custom post type posts by custom date
- custom post type single page
- call a function when insert and update a custom post type
- Custom Post Type
- Custom Post Status & Taxonomies
- Front-end form submission not creating post
- custom post type for custom talbe
- Post being scheduled that shouldnt be schedulded
- Custom Loop and Standard Blog Loop Issue
- Custom loop won’t work, can’t find problem
- Loop to pull content from parent element in custom post type [duplicate]
- Get custom post type parent category
- How to create custom page templates with default page layout framework?