Have a look on the date_query parameter that has been added to WP 3.7
WP_Query#Date_Parameters and the author parameter.
Combine the two parameters as you need them to query all posts an author created in a given time:
<?php
$args = array(
'posts_per_page' = -1, // get all posts
'author' => get_the_author_meta( 'ID' ), // from this author ID
'date_query' => array( // in the last week
array(
'year' => date('Y'),
'week' => date('W'),
),
'fields' => 'ids' // only return an array of post IDs
),
);
$results = new WP_Query( $args );
echo count( $results ); // display the number of results
echo $results->found_posts; // display the number of results
?>
Edit: I updated this answer based on input from @birgire to behave more performant.
Related Posts:
- Query posts distinct authors
- How to output comments number of a post per day?
- Fetch posts from current week (Sunday to Saturday)
- Get random posts between specific dates / of specific age
- If modified on same day, show only time
- Changing default WP-Site creation date
- How to get posts published on the latest date?
- wp_query if have posts show date but not in loop
- Date is wrong on ‘all posts’ page
- Get latest author posts inside the loop
- how to show comments only author which send own posts in wordpress
- Change Old WordPress Post Date Year
- How do you update post date (year only) in a separate custom field?
- How to hide meta from search result only on pages?
- How to get single post by one author?
- date_query returning only the most recent post instead of the post published before today
- Nested WP_Query breaking loop
- WordPress query_posts by tag doesn’t work anymore(?)
- obtain the author id given the post id
- Show comment number per author per day
- Get all comments of author’s posts
- How to display all posts divided/ordered by post date? [closed]
- (solved) getting post author’s user role
- Why Query is returning empty array?
- How do I extract just the post ID of the first item in whatever WP_Query returns?
- Show post content and title in diferent divs using WP_Query using a loop
- Change all author links in Blog roll
- Why are my paginated posts always returning the same results?
- Ignore latest two posts
- Is it possible to use WP_Query to only pull posts with attachments?
- Display author’s name and avatar in post’s sidebar
- Show posts by author of membership level (Paid Membership Pro)
- Inner join overrides Advanced Custom Fields plugin’s get_field [closed]
- meta_value timestamp older than now
- Every second post different class in blog view
- Loop doesn’t exclude the specified category in home page
- Get posts with multiple categories
- Do not show children of a category
- Display posts of specific category term
- Print out last 3 blogposts
- why the same code got different results when using query_posts in functions.php and index.php
- static landing page leading to author specific pages w/ “live” content
- Query posts by Author and/or by Tag
- Query for first 3 posts to change the look and feel
- If contributor has published 2 or more posts then show otherwise hide
- Why posts array is empty?
- Can’t understand why sometimes a [caption] field appears
- All Posts Linking to Author Posts directly
- Page and post loop same template
- Getting blog pagination to work on page set as front page
- How to group only VISIBLE posts? [closed]
- How to check in functions.php if there is data in a WP_Query?
- Shortcode with ‘year’ parameter
- search blog posts by author first name and or last name
- Change post author without using wp_update_post()
- Show metabox value last post excerpt, title and link
- Is it possible to lock all new and existing WordPress posts to one specific author?
- On what hook can I get the queried object’s final state?
- unique post in “$args” of wp_query display more than one post
- What date to use as a post date? date_gmt or modified_date_gmt
- Display current post position in Elementor Posts widget
- Why in my query is display two title?
- Migrate posts from category and sub-category via SQL
- How to get the ability to change the author of a post
- How do I insert a after every 5 posts in a WordPress Loop that infinitely loads posts?
- wp_query with ajax
- Echo Text If User Is Logged in But NOT the Author of post
- How to give classname to post if post has no content?
- How to update all posts at once?
- tribe_get_start_time displays the current date and time on other post types than tribe_events
- Custom wp-query in wordpress rest api
- Get the most recently modified post date of most recently modified post
- Only allow posts with a specific term to only be viewed by other authors with the same term in their post
- WP_Query: Show 10 posts in date order, first three random
- How can I insert a new markup element after 4 posts automatically? [closed]
- Exclude some posts from displaying in wp_query based on some condition
- Assigning Two Different Post Dates For Single Post
- posts_per_page returning only one post
- If no posts exist for current day and month, show the next available day of posts
- Using system date format
- WordPress Loop: How to display recent posts in multiple divs
- Random posts that always include a particular post?
- Need to know custom code to display random and most viewed posts in wordpress posts and pages
- Related Posts function not working
- How to retrieve certain number of images from a wordpress post?
- WordPress post filter menu
- Modify this line to give alternate format date?
- How to limit author related post listing ?
- Restrict displaying posts to the poster itself (in Back-end)
- How to show different timestamp
- Post: how to set created date after post has been published [closed]
- How to display post list in a table layout (multiple queries in single loop)
- Add “Posted on” to post date
- Auto update post title and slug when post status is changed
- Conflict array_splice on loop and query in widget
- Get total post from an author
- Not all posts showing in query
- how to handle the loop using filling bootstrap grid structure?
- Send email to author of post on post submission
- Get all custom posts with a certain taxonomy