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
- Default post showing more than intended
- button onclick with get_post_permalink
- Show Two custom Post type and their posts on category page
- wp_query to find posts by year and month
- WP_Query is printing out only one post when posts_per_page is set to multiple
- Loop of custom post type names
- Trying to edit the single page from a Custom Post
- How to Submit Post Via cURL & PHP
- Create a random unique 6 digit number as custom field for custom post type
- count_many_users_posts except current logged in user?
- How can I show a custom post type for users in the authors.php file?
- Creating Accordians in WordPress Theme
- Reset/Reorder posts ID in the MySQL wp_posts table
- WordPress post count not showing for custom post type author
- Remove duplicated values from a loop
- Blog page showing same content as homepage
- Using pre_get_posts to filter one loop in a multiloop archive
- Where to store custom tagging data associated with a custom post type
- apply filters only to specific post listing without check the url parameters
- Custom Post Type Taxonomies -Posts not showing in Category or Tag pages
- How Can I Set the Post Author of a Post I Just Created With PHP?
- Custom post type and body_class: Remove “blog” class
- WordPress Orderby Numeric Value Not Working
- Custom Post Type Loop within Shortcode
- How to insert content from another Custom Post type into Post?
- Filter post by current 2 differents users id
- Exclude child pages from archive.php
- is there a way to retrieve posts that do not have a featured image assigned?
- How do I find which articles are missing a featured image in The WordPress database?
- Auto-generated posts not showing in backend (but being counted!)
- Shortcode for display posts on home page show only one post
- Find the user who initially created the post
- Display different content on homepage depending on post type
- get_template_part for each level of taxonomy term
- WP_Query | ‘post_type’ doesn’t work
- How to call custom single post?
- How to connect two custom post types with nested loops
- Need help targeting a custom post type with conditional tags
- How to get the post type from a category id?
- Pass the_post() as a parameter
- Filter by custom taxonomy slug on a custom post type
- Query custom post type in the loop
- Creating Multiple Loops in Genesis, One Post then 20, each with custom fields
- Normal pages as children of my Custom Post Type
- Notice: Undefined index: suppress_filters
- How to Separate CPT From Regular Posts?
- Loop through Custom Post Type, and then show children within each iteration
- $wpdb: Counting posts corresponding to 3 terms in 3 different taxonomies