Weekly
Unpublish posts past a certain age
Posts older than your cutoff are set back to draft each week, and you get the list of what changed.
- Runs
- Weekly
- Apps
- WordPress
- AI
- Not needed
- Access
- read+write
Send this to your assistant
Create a ClickRuntime automation: every Sunday, set WordPress posts older than 2 years to draft, except those in the Evergreen category, and email me the list.
First time? Adding ClickRuntime to your assistant takes about two minutes.
Why use it
Why teams use this automation
News sites, event pages and promo blogs collect posts that go out of date. A discount code expired in March, a conference you ran in 2021 still shows registration open, and a price list from two years ago still ranks. Visitors land on the stale page, trust the wrong information and either complain or leave.
Every week, WordPress is asked for published posts dated before your cutoff, say 18 months back. Each one is set to draft, which removes it from public view without deleting a word, and you get an email listing exactly which posts were unpublished that week.
It is a good rule for sites where posts have a shelf life, such as local news, job boards, event calendars and seasonal promotions. The result is a live site where every public page can be trusted to be current, with no one assigned to clean up.
What you get out of it
Outdated offers stop misleading readers
A post advertising a sale that ended last year no longer sits live, which spares you angry customers and the support emails that follow. Customers who see accurate prices and dates trust the rest of the site more too.
Nothing is deleted
Drafts keep their text, images and URL slug in WordPress, so you can republish after updating the content, rather than rebuilding it from a backup. Updating and republishing a draft takes minutes, so good pages can come back whenever they are refreshed.
The site stays tidy without a clean-up day
Instead of a quarterly purge that nobody has time for, ageing content leaves the live site each week in small, reviewable batches. Small weekly batches are also easier to check than one large annual purge.
You see every change
The emailed list is a record of what was pulled down and when, which is useful when someone asks why an old link now shows a not-found page. That record answers questions from colleagues or customers who ask where an old page went.
Fewer stale pages for search engines
Pages that no longer deserve to rank stop dragging down the overall impression of a site, and the remaining live content is more current on average. A sharper set of live pages makes the site easier to navigate for readers and crawlers alike.
How it works
What happens, step by step
Every week, ClickRuntime finds the published WordPress posts older than the cutoff date you set.
It sets each of them back to draft, so they are no longer public.
You get an email listing the date and title of every post it changed.
Before it runs live
- Connect WordPress
What you get
Build your own
Need it to work differently?
Your own rules
Conditions, thresholds, filters and exceptions, written the way you'd explain them to a colleague.
Any number of apps
One automation can read from one app and update several others. Over 248 apps are ready, and anything with an API works too.
AI where it helps
Summaries, classification, extraction and drafts use ClickRuntime's built-in AI, with no extra key.
On a schedule or on each event
Runs as often as every 5 minutes, or the moment an app sends an event, and keeps track of what it already handled.
Changes you can ask for
- Run it at a different time, more or less often, or only on weekdays
- Add an AI step, for example to summarize, sort or draft a reply
- Add another app, for example also send it to Slack
- Combine it with other WordPress steps into one automation
Under the hood
The code that runs this automation
from datetime import datetime, timedelta, timezone
from clickruntime import on_trigger, credentials, http, notify
SITE = "https://blog.example.com"
def wp(method, path, **kw):
resp = http.request(method, f"{SITE}/wp-json/wp/v2/{path}", **kw,
auth=("admin", credentials.secret("WP_APP_PASSWORD")))
resp.raise_for_status()
return resp.json()
@on_trigger
def run(event):
cutoff = (datetime.now(timezone.utc) - timedelta(days=730)).strftime("%Y-%m-%dT%H:%M:%S")
evergreen = wp("GET", "categories", params={"slug": "evergreen"})[0]["id"]
posts = wp("GET", "posts", params={"before": cutoff, "status": "publish", "per_page": 100,
"categories_exclude": evergreen})
for p in posts:
wp("POST", f"posts/{p['id']}", json={"status": "draft"})
lines = [f"{p['date'][:10]} {p['title']['rendered']}" for p in posts]
if lines:
notify.email_me(f"{len(lines)} old posts moved to draft", "\n".join(lines))
return {"moved": len(lines)}FAQ
Common questions
How is the cutoff age decided?
Will unpublished posts break links pointing to them?
Can some posts be exempt, like evergreen guides?
What permissions does it need?
Does it need AI?
How many runs does it use?
Can I change how it works?
Related
You might also like
Get a monthly CSV of all your posts
A spreadsheet file with every post's title, link, status, date and categories arrives in your inbox each month.
See how it worksGet a daily list of new site sign-ups
Once a day you get the people who registered on your site since the last email.
See how it worksGet reminded about forgotten drafts
Every week you see the drafts nobody has touched in a month, so they get finished or deleted.
See how it worksKeep exploring
Set up “Unpublish posts past a certain age” from your assistant
Copy the prompt above, or connect your assistant first. Free plan, no credit card.