You should use cron job
. Yes WordPress has a function wp_schedule_event ()
. This function will perform certain operations based on the time difference you add it.
Say for example, if you schedule it daily
this will works everyday and perform the operarions on daily basis.
you can hook a function with wp_schedule_event
. Just get the published posts list and from the posts check the date of publish and current time. If it marches today leave it. Otherwise you can edit the post and change the status as draft or you can even delete it.
Here I didn’t give you code samples. If you require there are many question available about cron job and post status change. Just Go through it.
Related Posts:
- Increase 10 post limit per page
- Difference between an archive and a page listing posts
- has_archive=false on the default post type
- Different number of posts in each category
- Clear cache when a post is submitted [closed]
- How to limit user to publish post per day and per role?
- Create an “All Posts” or “Archives” Page with WordPress 3.0?
- Post Format Archive template name for theme folder?
- Restrict users from editing post based on the age of the post
- Restrict access to post if it is currently being edited
- widget should display post archive by year and on click also by month
- Must permalinks always point to single post pages?
- At my posts archive page, outside the loop, get_the_id() returns the top most post’s ID
- Display most recent post in category instead of archive?
- Single.php Active Category Class
- Link for the page archive for posts, like using custom post types with get_post_type_archive_link
- get_post_type_archive_link(‘post’) returns current category archive
- How to get the latest posting time of archived pages in WordPress?
- change default post archive page link
- WP_Query posts_per_page ignored
- Display all months with posts and inside each month show the 5 latest posts
- Display posts from #6 to #20 on archive page
- Category List (Archive) Page Template By Category
- Limiting the number of posts in WP_Query leads to unexpected result
- Getting category posts from a certain year
- Yearly archive page for future year
- Which URL to enter into browser to show all posts in archive.php?
- Limit posts per author role (excluding admin) in home page
- How to display data in archive page?
- Guest Author – How to display posts on /author/ archive page
- Restrict users post for himself
- How to limit posts by category
- Archiving by academic year instead of calendar year
- List category posts alphabetically on archive.php
- How can i limit the number of posts created per category?
- How to display excerpt post on hamepage and archive pages?
- Automatically create a new page daily with last three posts
- Archiving posts in wordpress
- query post limits
- Custom Post Type archive
- Does WP automatically tag posts into the archive?
- singular posts using archive styling
- Custom Post Limit for homepage only without plugin?
- How can I set a maximum allowed post size and number of posts submitted?
- Exclude a category of posts in author template
- How to edit the ‘
- Post-Archive like a page in a specific subdirectory
- Display in category ( taxonomy) a number of post that I want
- Setting limit to posts or page creation
- Find out in which kind of archive am I
- adding my posts (author posts) in menu
- How to view all posts (on site, not admin) that are uncategorized?
- Archieve page, Advertisement Every 3 Posts
- Highlighting Current Category in the Archive and Feeds page
- How to limit post (Exception pages) for current user in each role in front end?
- Permalink Short code showing unnecessary link text inside the loop
- How to hide protected posts from archive?
- blog post not accesible on click [closed]
- Limit front-end submitted posts by role
- Redirect to custom post if custom archive page has just one result?
- Posts are not displaying on their category and tag page
- If user has 1 post then dont let him create new one [closed]
- show image gallery in archives or category page
- Prevent Archive URLs
- view a list of 3 future post, from the nearest to the most far
- Get posts from category from custom query
- How do I apply a wordpress function to something with no ID inside an archive page?
- Page 2 has no posts?
- Disable archiving of old posts?
- is_archive() not working on selected “Posts page”
- numberposts not working
- How to display term in archive page?
- My posts section for logged in user
- How to organise post by category and date
- How Can I Limit Users to Post Creation For My Frontend Theme?
- Daily posts like an archive
- How to set a link to custom archieve page
- How to limit the number of results for all query_posts on mysite
- Set the limit to allow author when make post!
- How to get alphabetic listing x other posts, based on first letter post?
- How do I display the next 3 posts in the sidebar?
- limit posts per page
- Display all posts from selected month
- How to get pagination working with “Pending” Posts
- Show all posts in category
- custom sort posts in archive/taxanomy page
- wp trim function not working
- how to show all post with its contents
- Add author section on Author archive posts
- Display post count on archive page in reverse order
- Filter/Sort Post Form On Taxonomy page
- How to programmatically create posts in wordpress?
- is there a better way of combining this?
- wp-cli post create & media import issues
- How show categories in admin and get that selected to show posts in index
- Do not show children of a category
- Where exactly should I hook in order to change the post’s ID before insertion in the database?
- Make categories appear random
- How to find the edit link of the WordPress Post from the URL
- Post pages are redirecting to the 404 page in wordpress