Head image for post about Alt Text description, Rank Math and ImageInsight

Alt Text Best Practices: Why You Must Add It BEFORE Publishing (+ Rank Math Formula Guide)

The Alt Text Problem Nobody Talks About

You’ve just published a beautiful blog post with 10 images. A week later, you learn about alt text and decide to add it to your Media Library. You spend 20 minutes writing perfect, descriptive alt text for every image.

But here’s the problem: None of that alt text appears on your published page.

WordPress doesn’t automatically sync alt text from your Media Library to published posts. Once an image is inserted into a page, the alt text is “snapshotted” into the post_content field in your database at that exact moment. Change it later in the Media Library? The HTML stored in post_content remains unchanged.

This is the fundamental flaw in WordPress’s alt text system, and it’s why adding alt text BEFORE publishing is critical.


Why Adding Alt Text Before Publishing Saves You Hours

The WordPress Alt Text Reality

When you insert an image into a post, WordPress takes a “snapshot” of the alt text at that exact moment. After that, the alt text lives in two separate places:

  1. Media Library (metadata database)
  2. Post content (hard-coded HTML)

These two don’t sync. Ever.

The Time Cost of Doing It Wrong

If you add alt text AFTER publishing:

  • Open Post #1 → Click Image #1 → Edit alt text → Click Image #2 → Edit alt text → Save
  • Open Post #2 → Repeat…
  • Open Post #3 → Repeat…

For 50 blog posts with 5 images each = 250 manual edits 😰

If you add alt text BEFORE publishing:

  • Upload image → Add alt text in Media Library → Insert into post → Done ✅

Manual vs. Automated Alt Text: The Trade-Off

The Gold Standard: Manual Alt Text

Example:

<img src=”dog-training.jpg” alt=”Black labrador performing scent detection exercise with handler at outdoor training facility”>

Pros:

  • ✅ Accurate and descriptive
  • ✅ Unique for each image
  • ✅ Best for accessibility and SEO
  • ✅ Follows W3C guidelines

Cons:

  • ❌ Time-consuming (2-3 minutes per image)
  • ❌ Requires discipline
  • ❌ Easy to forget

Best for: High-value pages (homepage, services, key landing pages)


The Pragmatic Solution: Rank Math Automation

For blogs with hundreds of images, writing manual alt text for everything isn’t realistic. This is where SEO plugins like Rank Math come in.

Rank Math can dynamically inject alt text server-side when the page loads, using formulas with variables like:

  • %filename% – Image filename
  • %posttitle% – Post/page title
  • %rankmathfocuskw% – Your focus keyword

Important technical note: Rank Math processes alt text on the server before sending HTML to the browser. This means search engines, screen readers, and accessibility scanners will all see the alt text. This is different from JavaScript-based solutions that inject alt text client-side—those won’t satisfy accessibility requirements or be visible to crawlers.

How it works: When someone visits your page, Rank Math checks each image. If the alt attribute is empty in your stored HTML, it injects alt text based on your formula. The original database content remains unchanged, but visitors and search engines see the completed alt text.


RankMath Alt Text Formulas: Pros & Cons

Quick Reference: Formula Comparison

FormulaUniquenessBest ForAvoid If
%filename%✅ Unique per imageSites with descriptive filenamesFiles named IMG_1234.jpg
%posttitle%❌ Same for all imagesSingle-image pages onlyMultiple images per page
%filename% – %posttitle%✅ Unique with contextCompromise solutionFilename + title too long
%posttitle% %rankmathfocuskw%❌ Same for all imagesKeyword-heavy single imagesAccessibility concerns

Option 1: Filename Only (Default)

Formula: %filename%

Example:

  • Filename: dog-scent-detection-training.jpg
  • Alt text: “Dog scent detection training”

Pros:

  • ✅ Each image gets unique alt text
  • ✅ Simple and predictable
  • ✅ Works well if you name files descriptively

Cons:

  • ❌ Useless if filename is IMG_1234.jpg
  • ❌ May include technical info: image-1024×768
  • ❌ Requires good filename discipline

Verdict: ⭐⭐⭐⭐ Best automated option IF you commit to descriptive filenames


Option 2: Post Title Only

Formula: %posttitle%

Example:

  • Post: “Scent Detection Class: Unleash Your Dog’s Nose”
  • All images: “Scent Detection Class: Unleash Your Dog’s Nose”

Pros:

  • ✅ Provides context
  • ✅ Always populated
  • ✅ SEO-relevant

Cons:

  • ❌ NOT unique – all images get identical alt text
  • ❌ Doesn’t describe individual images
  • ❌ Poor for accessibility (screen readers hear same thing repeatedly)
  • ❌ Google wants unique alt text per image

Verdict: ⭐⭐ Only use for single-image pages


Option 3: Filename + Post Title

Formula: %filename% – %posttitle%

Example:

  • Filename: lottie-training.jpg
  • Post: “Scent Detection Class”
  • Alt text: “Lottie training – Scent Detection Class”

Pros:

  • ✅ Unique per image (filename)
  • ✅ Provides context (post title)
  • ✅ Compromise between automation and quality

Cons:

  • ❌ Can get long and awkward
  • ❌ Somewhat redundant
  • ❌ Still requires good filenames

Verdict: ⭐⭐⭐ Decent middle ground


Option 4: Post Title + Focus Keyword

Formula: %posttitle% %rankmathfocuskw%

Example:

  • Post: “Scent Detection Class”
  • Focus keyword: “dog training”
  • Alt text: “Scent Detection Class dog training”

Pros:

  • ✅ SEO-optimized with target keywords
  • ✅ Relevant to page content

Cons:

  • ❌ NOT unique – all images identical
  • ❌ Keyword-focused, not image-focused
  • ❌ Doesn’t describe what’s actually in the image

Verdict: ⭐⭐ Only for single-image pages or keyword stuffing (not recommended)


Critical: Rank Math Won’t Override Your Manual Alt Text

Good news: Rank Math’s “Add Missing ALT Attributes” feature only fills in the blanks—it never overwrites existing alt text.

How It Works:

Scenario 1: You add alt text in Media Library BEFORE inserting ✅

  1. Upload image → Add alt text: “Dog performing scent detection”
  2. Insert into post → WordPress copies: alt=”Dog performing scent detection”
  3. Rank Math sees alt text exists → Leaves it alone
  4. Your manual alt text stays intact ✅

Scenario 2: You forget to add alt text ⚠️

  1. Upload image → Leave alt text empty
  2. Insert into post → WordPress creates: alt=””
  3. Rank Math sees empty alt → Fills with formula (e.g., filename)
  4. Alt text appears as “image-filename” ⚠️

This Enables a Hybrid Strategy:

Priority images (20%):

  • Write manual alt text in Media Library BEFORE inserting
  • Rank Math respects these and won’t touch them

Regular images (80%):

  • Skip alt text, let Rank Math auto-fill with %filename%
  • As long as filenames are descriptive, results are acceptable

You get the best of both worlds: Manual control where it matters, automatic backup where you forget.


Watch Out for Repeated Images

Important consideration: If you reuse the same image file across multiple posts:

Using %posttitle% formula:

  • Homepage: “Professional Dog Training Services”
  • Blog Post: “5 Scent Detection Tips”
  • About Page: “Meet Our Team”

Result: Same physical image gets different alt text on each page. This can be confusing for accessibility if the image shows the same thing but has different descriptions.

Using %filename% formula:

  • All pages: “team-photo-2024”

Result: Same alt text everywhere, which is consistent but may lack page-specific context.

Best Practice for Reused Images:

If you’re using a hero image, logo, or key photo across multiple pages:

  • ✅ Add manual alt text in Media Library before first use
  • ✅ Keep it generic enough to work everywhere: “Adventure Canine training facility exterior”
  • ❌ Don’t rely on %posttitle% for frequently reused images

The Tiered Approach: Best Practice for Real Websites

Don’t try to do everything manually OR everything automated. Use a strategic, tiered approach:

Tier 1: Manual Alt Text (20% of images)

Pages: Homepage, main services, key landing pages, featured blog posts

Why: These pages drive most of your traffic and conversions

Time investment: 30-60 minutes total

Example:

“Professional dog trainer demonstrating scent detection techniques

with black labrador in outdoor training facility”


Tier 2: Good Filenames + Rank Math (70% of images)

Pages: Regular blog posts, secondary pages

Rank Math formula: %filename%

Critical requirement: Rename files BEFORE upload

Good filenames:

  • ✅ dog-scent-detection-exercise.jpg
  • ✅ adventure-canine-training-class.jpg
  • ✅ puppy-nose-work-session.jpg

Bad filenames:

  • ❌ IMG_1234.jpg
  • ❌ DSC_9876.jpg
  • ❌ Screenshot-2025-01-15.png

Tier 3: Accept Imperfection (10% of images)

Pages: Archive pages, low-priority content, decorative images

Approach: Let Rank Math handle it with %filename% or even %posttitle%

Reality: Some images just aren’t that important


The Filename Strategy (If Using Rank Math)

If you’re using %filename% in Rank Math, your filename strategy becomes CRITICAL. Let’s see a real-world transformation:

Before/After Example:

Before (camera default):

IMG_1234.jpg → Alt text: “IMG 1234” ❌

DSC_9876.jpg → Alt text: “DSC 9876” ❌

20250131_142503.jpg → Alt text: “20250131 142503” ❌

After (descriptive rename):

black-labrador-scent-training.jpg → Alt text: “Black labrador scent training” ✅

adventure-canine-class-binfield.jpg → Alt text: “Adventure canine class binfield” ✅

puppy-nose-work-exercise.jpg → Alt text: “Puppy nose work exercise” ✅

The difference? 30 seconds of renaming before upload = perfect alt text automatically.


Before Upload Checklist:

  1. ✅ Use descriptive words: dog-training-session.jpg
  2. ✅ Use hyphens (not underscores): scent-work.jpg not scent_work.jpg
  3. ✅ Keep it concise: 3-5 words max
  4. ✅ Use lowercase: training-class.jpg not Training-Class.JPG
  5. ✅ Remove dates/sizes: puppy-class.jpg not puppy-class-2025-1024×768.jpg

Batch Renaming Tools:

  • Mac: Finder (select files → right-click → Rename)
  • Windows: PowerRename (built into PowerToys)
  • Cross-platform: Bulk Rename Utility

Spend 5 minutes renaming 20 images, and Rank Math will generate decent alt text automatically.


What About After Publishing?

If you’ve already published posts without alt text, you have three options:

Option 1: Enable Rank Math’s Dynamic Alt Text

Go to Rank Math SEO → General Settings → Images

  • Enable “Add Missing ALT Attributes”
  • Set format to %filename%
  • Save settings

Result: Alt text appears on your pages immediately (dynamically injected)

Note: Alt text won’t show in Media Library or post editor – only on the live page.


Option 2: Manual Fix for Key Pages

  1. Edit the post
  2. Click each image
  3. Add alt text in the right sidebar “Alt Text” field
  4. Save post

Use for: Your most important 10-20 pages


Option 3: Use a Sync Plugin

Plugins like Image Attributes Pro or AltText.ai can bulk update alt text from Media Library to published posts.

Cost: $49-$99

Worth it if: You have 100+ posts and good alt text already written in Media Library


The European Accessibility Act 2025

Important: Starting June 28, 2025, the European Accessibility Act (EAA) requires digital services—including e-commerce websites, banking services, and other consumer-facing platforms—to meet accessibility standards, which includes descriptive alt text for all images.

Who’s Affected?

  • E-commerce websites selling to EU customers
  • Digital service providers operating in the EU
  • Banking and financial services platforms
  • Consumer services with an online presence

What This Means:

  • Alt text becomes legally mandatory, not just best practice
  • Non-compliance can result in penalties
  • Applies to both new and existing content

Bottom line: If you do business in Europe or serve EU customers, missing alt text is now a compliance issue. Even if you’re outside the EU, following these standards makes your site more accessible and SEO-friendly globally.

Not sure if you’re in scope? Consult the official EU guidance or a legal professional specializing in digital accessibility.


Quick Reference: Best Rank Math Formula

Rank Math logo blue and black

If you must choose ONE formula:

%filename%

But only if you commit to:

  1. Renaming files descriptively BEFORE upload
  2. Using hyphens for readability
  3. Keeping filenames to 3-5 words
  4. Manually editing top 20% of images anyway

Your Alt Text Action Plan: Quick Checklist

Use this checklist to implement alt text best practices on your site:

Before Publishing Any Post:

Rename image files descriptively

  • Convert IMG_1234.jpg → dog-scent-training.jpg
  • Use hyphens, not underscores or spaces
  • Keep to 3-5 descriptive words

Add manual alt text to priority images

  • Homepage images
  • Featured images
  • Key service/product photos
  • Images used across multiple pages

Configure Rank Math (one-time setup)

  • Go to Rank Math SEO → General Settings → Images
  • Enable “Add Missing ALT Attributes”
  • Set format to %filename%
  • Save settings

Insert images into post

  • Images with manual alt text = protected from Rank Math
  • Images without alt text = automatically filled by Rank Math

After Publishing:

Test on live page

  • Right-click image → Inspect element
  • Verify alt text appears in HTML
  • Check that it’s descriptive and unique

For existing content (optional)

  • Use alt text scanner to identify gaps
  • Prioritize fixing top 20% of pages manually
  • Let Rank Math handle the rest

Monthly Maintenance:

Audit new content

  • Spot-check recent posts for alt text
  • Ensure filename strategy is working
  • Update any poor auto-generated alt text manually

Review high-traffic pages

  • Check Google Search Console for top pages
  • Manually improve alt text on pages driving traffic
  • Update reused images if context changed

Conclusion: The One Rule You Must Follow

Add alt text BEFORE publishing.

Whether you:

  • Write it manually in Media Library
  • Let Rank Math generate it from filenames
  • Use AI tools to create it

Do it BEFORE you insert the image into your post. This one habit will save you dozens of hours of retroactive editing.

The 80/20 Rule for Alt Text:

  • Spend 80% of your effort on the 20% of images that matter most
  • Let automation handle the other 80% of images
  • Review and refine over time

Start today: Follow the action checklist above. Begin with your homepage and top 5 pages. Rename your next 10 images descriptively before upload. Enable Rank Math as your safety net.

And remember: automated alt text is a fallback, not a solution. For your most important pages, invest the 2 minutes per image to write proper, descriptive alt text. Your users, Google, and—increasingly—the law will thank you.


Need help auditing your site’s alt text? Consider using an alt text scanner such as ImageInsight to identify which images need attention. Focus on fixing your top 20% of pages manually, configure Rank Math for automatic backup, and maintain good filename discipline going forward.


Free tools to help you Create & Improve your website

Ping website tool icon

Online Ping Website Tool

Free Ping Website Tool: Verify Uptime & Latency Instantly check your website’s availability and network performance. Our online tool helps diagnose issues […]

Plugin scanner icon

SiteInshight Scanner

Ever wondered what plugins your competitors are using? Curious about how successful WordPress websites achieve their performance? Our free WordPress Plugin Scanner […]

XML sitemap icon

XML Sitemap Generator

Effortlessly create an XML sitemap for your website with our free XML Sitemap Generator. Notify search engines about your web pages and […]

Screenshot icon

Website Screenshot Generator

Capturing professional website screenshots is essential for portfolios, client presentations, documentation, competitor analysis, and record-keeping, but manually taking screenshots can be time-consuming […]

Imageinsight icon

ImageInsight

Transform Your Website’s Visual Performance with AI-Powered Image Analysis You can use the ImageInsight tool here for free or get more features […]

Leave a Reply

Your email address will not be published. Required fields are marked *