Skip to content

About

Audit a WordPress posts CSV export for content decay: stale, thin and uncategorised posts, with a refresh priority table. Zero-dependency Python CLI.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

wp-post-doctor

License: MIT PRs Welcome

A zero-dependency Python CLI that audits a WordPress posts CSV export for the content decay that quietly drains a blog's search traffic: published posts not updated in a long time, thin posts under a word threshold, posts with no featured image, no excerpt, or no category, duplicate titles or slugs, stale drafts older than the same threshold, posts whose last-modified date is before their publish date, and bad data such as malformed rows, invalid dates, and invalid word counts or view counts. It also prints a refresh priority table ranked by age and traffic, so a blog owner can see which post to update first.

Updating old posts is one of the highest return chores in content work. HubSpot's historical optimization program found that updating and republishing old posts lifted monthly organic search views by an average of 106 percent, and 76 percent of its monthly blog views and 92 percent of its leads came from old posts. Semrush content audit data shows 82 percent of high-ranking posts start losing traffic within 12 to 24 months without maintenance. SEO plugins audit meta live inside WordPress, so this tool audits the posts export offline, before the next content sprint, and ranks what to refresh first.

Install

Requires Python 3.9 or newer. No dependencies beyond the standard library.

pip install wp-post-doctor

Or run it straight from the source checkout:

python3 wp_post_doctor.py examples/posts.csv

Input format

A CSV export with a header row, one row per post. Columns used: post_id (or post, id), title, slug, status, published_date, last_modified_date, word_count, category, featured_image, excerpt, and views. Extra columns are ignored, so a full posts export works as-is. A UTF-8 BOM header is handled. Only post_id is required; the other columns are optional, and the checks that need a missing column are skipped.

title also accepts post_title; slug also accepts post_name or post_slug; status also accepts post_status; published_date also accepts published, date, published_at, or post_date; last_modified_date also accepts modified, last_modified, updated, modified_date, or post_modified; word_count also accepts words or wordcount; category also accepts categories or category_name; featured_image also accepts featured_image_url, has_featured_image, or image; excerpt also accepts has_excerpt or post_excerpt; views also accepts pageviews or page_views.

status is one of published, draft, pending, private, trash, scheduled, or future. The spelling publish is not in that list and is warned about as an unknown status. Dates accept ISO 8601 with or without a timezone (2026-11-18, 2026-11-18 08:00, 2026-11-18T08:00:00Z), plus day/month/year and month/day/year forms. A date with no timezone is read as UTC. Word counts and views accept whole numbers, with optional thousands commas (18,200).

post_id,title,slug,status,published_date,last_modified_date,word_count,category,featured_image,excerpt,views
P-101,How to Speed Up WordPress,how-to-speed-up-wordpress,published,2024-11-01,2025-01-05,1450,Tutorials,yes,yes,18200
P-103,WordPress Security Checklist,wordpress-security-checklist,published,2023-03-15,2023-03-15,180,Security,no,no,22100
P-108,Draft: Black Friday Deals Roundup,black-friday-deals,draft,,2025-08-01,300,,,,0
P-109,WordPress 6.8 New Features,wordpress-68-new-features,published,2026-11-01,2026-10-15,640,News,yes,yes,3200
P-120,WordPress Security Checklist,wordpress-security-checklist,published,2026-06-01,2026-11-09,1500,Security,yes,yes,7100

The featured_image and excerpt columns accept yes/no flags, and also the real values an export holds: an image URL counts as a featured image, and excerpt text counts as an excerpt, so a non-empty value in either column means the thing exists. An empty word_count means no count was recorded, and the thin post check is skipped for that post with a warning. An empty views means no view count was recorded, and the post is left out of the views total.

What it checks

Errors, the ones that mean decay, duplication, or badly recorded data:

  • stale-post: a published post whose last modified date is more than --stale-days (default 365) before the --as-of date. A post updated exactly 365 days ago passes.
  • thin-post: a published post with fewer than --min-words (default 300) words. A post with exactly 300 words passes.
  • duplicate-title: the same title, compared case-insensitively with collapsed whitespace, on two posts. Each duplicate is reported once, on the later row.
  • duplicate-slug: the same slug, compared case-insensitively, on two posts. Each duplicate is reported once, on the later row.
  • modified-before-published: a published post whose last-modified date is before its publish date, so one of the two dates is wrong. Scheduled posts are exempt: a scheduled post's modified date is normally before its future publish date.
  • malformed-row: a row with the wrong number of fields. The row is skipped and reported, never a crash.
  • invalid-date: a published or last modified date that matches no known format. The row is still audited on the fields that did parse.
  • invalid-word-count: a word count that is not a valid non-negative whole number. The thin post check is skipped for that post.
  • invalid-views: a views count that is not a valid non-negative whole number. It is left out of the views total.
  • missing-title: a post with no title, so it cannot be found by its title or checked for duplicate titles.

Warnings, patterns worth investigating:

  • stale-draft: a draft last touched more than --stale-days (default 365) before the --as-of date. The last modified date is used, or the published date when no modified date is recorded. A draft updated exactly 365 days ago passes.
  • no-featured-image: a published post with no featured image, so it shows no thumbnail in archives and social shares.
  • no-excerpt: a published post with no excerpt, so archive pages fall back to a cut-off first paragraph.
  • no-category: a published post with no category, so readers cannot find it by browsing the blog.
  • missing-word-count: a published post with no word count recorded, so the thin post check was skipped for that post.
  • missing-slug: a post with no slug, so WordPress will generate one from the title and the URL may change.
  • unknown-status: a status that is not one of the known statuses. The post is treated as not published.

The summary reports the post, published, and draft counts, the counts of stale and thin posts and duplicate titles and slugs, and the total views and words. The refresh priority table lists the published posts that have findings, ranked by days since update and then by views, both highest first: the oldest high-traffic post is the one to refresh first. Posts with no parseable last modified date are left out of the table. Drafts and scheduled posts never appear in it.

Usage

python3 wp_post_doctor.py examples/posts.csv --as-of 2026-11-18

Captured output:

ERROR [invalid-date] P-121: last_modified_date 'not-a-date' is not a readable date
ERROR [invalid-word-count] P-122: word_count 'abc' is not a valid non-negative whole number, so the thin post check was skipped for this post
ERROR [malformed-row] row 24: row has 4 fields but the header has 11, so the row was skipped
ERROR [invalid-views] P-124: views 'not-a-number' is not a valid non-negative whole number, so it was left out of the views total
ERROR [stale-post] P-101: last updated 2025-01-05, 682.0 days ago, more than the 365 day stale threshold, so the post is due a refresh
ERROR [stale-post] P-103: last updated 2023-03-15, 1344.0 days ago, more than the 365 day stale threshold, so the post is due a refresh
ERROR [thin-post] P-103: post has only 180 words, below the minimum of 300, so it is too thin to rank well
WARNING [no-featured-image] P-103: post has no featured image, so it shows no thumbnail in archives and social shares
WARNING [no-excerpt] P-103: post has no excerpt, so archive pages fall back to a cut-off first paragraph
WARNING [no-featured-image] P-104: post has no featured image, so it shows no thumbnail in archives and social shares
ERROR [thin-post] P-106: post has only 250 words, below the minimum of 300, so it is too thin to rank well
WARNING [no-excerpt] P-106: post has no excerpt, so archive pages fall back to a cut-off first paragraph
ERROR [stale-post] P-107: last updated 2024-06-01, 900.0 days ago, more than the 365 day stale threshold, so the post is due a refresh
WARNING [stale-draft] P-108: draft last touched 2025-08-01, 474.0 days ago, more than the 365 day stale threshold, so finish it or delete it
ERROR [modified-before-published] P-109: last_modified_date 2026-10-15 is before published_date 2026-11-01, so one of the two dates is wrong
ERROR [thin-post] P-110: post has only 95 words, below the minimum of 300, so it is too thin to rank well
ERROR [stale-post] P-111: last updated 2025-09-10, 434.0 days ago, more than the 365 day stale threshold, so the post is due a refresh
ERROR [stale-post] P-113: last updated 2024-02-10, 1012.0 days ago, more than the 365 day stale threshold, so the post is due a refresh
WARNING [no-featured-image] P-113: post has no featured image, so it shows no thumbnail in archives and social shares
WARNING [no-excerpt] P-113: post has no excerpt, so archive pages fall back to a cut-off first paragraph
ERROR [thin-post] P-118: post has only 280 words, below the minimum of 300, so it is too thin to rank well
WARNING [no-category] P-119: post has no category, so readers cannot find it by browsing the blog
ERROR [missing-title] P-125: post has no title, so it cannot be found by its title or checked for duplicate titles
WARNING [missing-slug] P-125: post has no slug, so WordPress will generate one from the title and the URL may change
WARNING [stale-draft] P-128: draft last touched 2024-12-01, 717.0 days ago, more than the 365 day stale threshold, so finish it or delete it
ERROR [duplicate-title] P-105: title 'How to Speed Up WordPress' is already used by post P-101, so the two posts compete for the same search result
ERROR [duplicate-title] P-114: title 'Best Free SEO Plugins' is already used by post P-104, so the two posts compete for the same search result
ERROR [duplicate-title] P-117: title 'Fixing WooCommerce Checkout Errors' is already used by post P-102, so the two posts compete for the same search result
ERROR [duplicate-title] P-120: title 'WordPress Security Checklist' is already used by post P-103, so the two posts compete for the same search result
ERROR [duplicate-slug] P-120: slug 'wordpress-security-checklist' is already used by post P-103, so the two posts compete for the same search result

Posts: 27, findings: 30, errors: 20, warnings: 10
Published: 23, drafts: 3, stale posts: 5, thin posts: 4, duplicate titles: 4, duplicate slugs: 1
Total views: 180,600, total words: 20,685

Refresh priority:
post     title                                      days stale      views findings
P-103    WordPress Security Checklist                   1344.0     22,100        4
P-113    WordPress Multisite Setup Guide                1012.0      8,900        3
P-107    WooCommerce Payment Gateways Explained          900.0     19,800        1
P-101    How to Speed Up WordPress                       682.0     18,200        1
P-111    How to Add Google Analytics                     434.0      7,400        1
P-117    Fixing WooCommerce Checkout Errors              231.0      3,300        1
P-105    How to Speed Up WordPress                        64.0      8,700        1
P-109    WordPress 6.8 New Features                       34.0      3,200        1
P-104    Best Free SEO Plugins                            17.0     15,300        1
P-122    WordPress Image Optimization                     15.0      4,400        1
P-120    WordPress Security Checklist                      9.0      7,100        2
P-106    Migrate WordPress to a New Host                   8.0      4,100        2
P-125                                                      7.0      1,500        2
P-110    Fixing the White Screen of Death                  6.0     12,600        1
P-114    Best Free SEO Plugins                             4.0      2,100        1
P-118    WordPress Caching Explained                       3.0      6,100        1
P-119    Elementor vs Gutenberg                            2.0      2,900        1
P-124    WordPress Database Cleanup                        1.0          0        1

The sample has 28 rows; the malformed row 24 is skipped, so 27 posts are audited. The headline numbers are 30 findings, 20 errors, 10 warnings, and 180,600 total views. P-103 is the worst post on the blog: not updated in 1344.0 days, only 180 words, no featured image, and no excerpt, while still pulling 22,100 views, so it tops the refresh priority table. P-113 is next at 1012.0 days with no image and no excerpt. P-120 duplicates both the title and the slug of P-103, so the two posts compete for the same search result. P-109 was last modified before it was published, so one of its dates is wrong. The two stale drafts are P-108, untouched since 2025-08-01, and P-128, untouched since 2024-12-01. P-127 was last updated 363 days before the as-of date, so it passes the 365 day stale threshold on the boundary, and the scheduled post P-126 is correctly skipped from every content check.

Use it as a CI gate: --check exits 1 when any error is found, and 0 otherwise. On the sample above it exits 1:

python3 wp_post_doctor.py examples/posts.csv --as-of 2026-11-18 --check

On examples/clean.csv, four clean posts, it exits 0:

python3 wp_post_doctor.py examples/clean.csv --as-of 2026-11-18 --check

Posts: 4, findings: 0, errors: 0, warnings: 0
Published: 3, drafts: 1, stale posts: 0, thin posts: 0, duplicate titles: 0, duplicate slugs: 0
Total views: 4,500, total words: 3,100

Refresh priority:
post     title                                      days stale      views findings

All posts clean.

The clean file tests a boundary: C-202 has exactly 300 words and passes the thin check. The exact 365 day stale boundary is covered in the test suite, where a post updated exactly 365 days before the as-of date passes.

With --strict, --check also fails on warnings. examples/warnings-only.csv has one post with no featured image and one with no excerpt and no category, so it passes --check (exit 0) and fails --check --strict (exit 1). With a 2000 day stale threshold the stale posts and stale drafts drop out of the sample report:

python3 wp_post_doctor.py examples/posts.csv --as-of 2026-11-18 --stale-days 2000 --check

That run leaves 23 findings, 15 errors, and 8 warnings, with stale posts at 0. With a 100 word minimum the thin posts mostly drop out instead:

python3 wp_post_doctor.py examples/posts.csv --as-of 2026-11-18 --min-words 100 --check

That run leaves 27 findings, 17 errors, and 10 warnings, with thin posts at 1: only P-110, at 95 words, is still thin.

--json emits the summary, the refresh priority table, and the findings as JSON, and --out writes the report to a file.

Options

Flag Meaning
--stale-days A published post not updated in more than this many days is flagged as stale, and a draft untouched for longer is flagged as a stale draft (default: 365)
--min-words A published post with fewer words than this is flagged as thin (default: 300)
--as-of Date to compare last modified dates against, for example 2026-11-18 (default: now)
--json Emit JSON instead of text
--check Exit 1 if any error is found
--strict With --check, also exit 1 on warnings
--out Write the report to a file

Edge cases

  • A row with too many or too few fields is a malformed-row error and is skipped; the rest of the file is still audited.
  • A bad date is an invalid-date error, and the row is still audited on the fields that did parse, so one bad date never hides the other problems on the post.
  • A post updated exactly --stale-days ago passes the stale check, and a post with exactly --min-words words passes the thin check. Both thresholds are strict.
  • Drafts are checked only for going stale; scheduled posts skip the content checks, and a scheduled post's modified date being before its future publish date is not an error. An unknown status is warned about and treated as not published.
  • Duplicate titles compare case-insensitively with collapsed whitespace, and duplicate slugs compare case-insensitively. Each duplicate is reported once, on the later row. A post with no title is not counted as a duplicate of another untitled post.
  • A featured image column holding a URL counts as a featured image, and an excerpt column holding excerpt text counts as an excerpt. Only an empty value, or an explicit no value, counts as missing.
  • A blank line in the file is skipped silently. A post whose word count is present but invalid is an invalid-word-count error and does not also get a missing-word-count warning.
  • --as-of makes runs reproducible: without it, the stale checks compare against the current time.

Tests

python3 -m unittest discover -s tests -v

88 tests, all passing: date, integer, and flag parsing, header aliases and BOM handling, malformed rows, invalid dates, word counts, and views, stale and thin posts at and around both thresholds, missing featured images, excerpts, categories, titles, and slugs, stale drafts, drafts and scheduled posts skipped from content checks, unknown statuses, modified-before-published dates, duplicate titles and slugs, refresh priority ranking, summary counts and totals, text and JSON output, and --check and --strict exit codes. The same 88 tests pass under pytest.

License

MIT. See LICENSE.

About

Audit a WordPress posts CSV export for content decay: stale, thin and uncategorised posts, with a refresh priority table. Zero-dependency Python CLI.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages