Introduction
Incorrect image schema markup in WordPress can quietly suppress rich results for online course platforms, especially when course cards, instructor bios, lesson thumbnails, and featured images are generated by multiple plugins. In 2026, this problem shows up most often on WordPress 6.8 course sites running LMS plugins such as LearnDash, Tutor LMS, or LifterLMS alongside Yoast SEO, Rank Math, or custom schema code. The result is familiar: Google reads the wrong image, sees duplicate `ImageObject` entries, or flags invalid URLs in Search Console.
For course businesses, image schema errors matter because course pages rely on visual trust signals. If your JSON-LD points to cropped placeholders, blocked CDN assets, or mismatched media dimensions, search engines may ignore the image entirely. This guide shows how to fix incorrect image schema markup in WordPress for online course platforms using plugin inspection, theme-level overrides, validation, and repeatable checks.
Prerequisites
What you need is a current WordPress course stack and access to edit plugin or theme behavior safely.
- WordPress 6.8 or later
- PHP 8.2 or PHP 8.3
- MySQL 8.0 or MariaDB 10.6+
- An LMS plugin such as LearnDash 4.x, Tutor LMS 3.x, or LifterLMS 8.x
- One SEO plugin only for schema output, preferably Yoast SEO 24.x or Rank Math 1.0.240+
- WP-CLI 2.11+
- SSH or hosting panel access as a non-root deployment user
- A staging site that mirrors production media paths and CDN rules
Installation Or Setup
What you need first is a clean way to inspect where image schema is being generated, because course platforms often output schema from three places at once: the SEO plugin, the LMS plugin, and custom theme snippets.
Start by identifying active plugins:
wp plugin list --status=active
Expected output will look similar to this:
+----------------+--------+-----------+---------+
| name | status | update | version |
+----------------+--------+-----------+---------+
| learndash | active | none | 4.21.0 |
| wordpress-seo | active | available | 24.7 |
| advanced-custom-fields | active | none | 6.4.1 |
+----------------+--------+-----------+---------+
Then search your codebase for schema filters or hardcoded `ImageObject` blocks. Run this as your normal app user from the WordPress root:
grep -RniE 'ImageObject|schema.org|ld\+json|thumbnailUrl|contentUrl' wp-content/themes wp-content/plugins
If your LMS templates are overridden inside a child theme, also inspect those template paths:
find wp-content/themes -type f | grep -E 'single-course|lesson|topic|schema|json'
For media-heavy sites, it also helps to review image-related plugin pages and documentation before changing anything. Useful references from Flux include Media Optimizer, Alt Text Checker, AI Media Alt Creator, and the broader articles library.
Configuration
What you are configuring is a single source of truth for course page images, because schema breaks when multiple systems disagree about which asset represents the course.
Map The Correct Image Field
Most course sites have at least four candidate images:
| Image Source | Typical Use | Good For Schema | Common Problem |
|---|---|---|---|
| Featured image | Course archive and single page | Yes | Missing full-size URL |
| Instructor avatar | Author block | No for course image | Gets injected incorrectly |
| Lesson thumbnail | Lesson cards | Sometimes | Replaces parent course image |
| CDN-transformed image | Performance delivery | Yes, if crawlable | Signed or blocked URL |
Your schema image should usually be the primary featured image for the course post type, not the first image found in page content.
If Yoast is your schema source, verify that the course custom post type supports thumbnails and Open Graph images. If the post type was registered manually, check its arguments in your plugin or theme code:
register_post_type('sfwd-courses', [
'supports' => ['title', 'editor', 'thumbnail', 'excerpt'],
'public' => true,
'show_in_rest' => true,
]);
If `thumbnail` support is missing, WordPress may fall back to unstable image selection.
Remove Duplicate Schema Sources
Course plugins sometimes inject their own JSON-LD while Yoast or Rank Math does the same job. Pick one primary schema generator.
A common WordPress fix is disabling custom theme schema when Yoast is active:
add_action('init', function () {
if (defined('WPSEO_VERSION')) {
remove_action('wp_head', 'mytheme_output_course_schema', 20);
}
});
If your theme uses a custom schema callback in `functions.php`, move that logic into a guarded condition instead of letting both outputs run.
Normalize The Image URL
In 2026, the most frequent issue is not missing schema but a bad image URL inside valid JSON-LD. Typical failures include:
- Relative URLs such as `/wp-content/uploads/…`
- WebP derivatives that no longer exist after regeneration
- Private CDN URLs with query signatures
- Attachment pages instead of direct media files
For custom schema, force a canonical image URL and dimensions:
$image_id = get_post_thumbnail_id($post_id);
$image = wp_get_attachment_image_src($image_id, 'full');
if ($image) {
$schema['image'] = [
'@type' => 'ImageObject',
'url' => $image[0],
'width' => (int) $image[1],
'height' => (int) $image[2],
];
}
Use `full`, not a small generated size, unless your schema strategy explicitly requires a specific crop.
Respect CDN And Proxy Rules
If your course platform serves media from a CDN domain, make sure the image URL in schema is publicly reachable without cookies, expiring tokens, or referer restrictions. This matters when using offloaded media or image optimization layers. If you are cleaning up delivery issues, the performance guidance in Web Image Performance In 2026 is relevant, but do not let optimization rewrite schema to transient URLs.
Usage Or Execution
What you are doing here is auditing live schema output, correcting the source, and verifying that the final course page emits one valid image definition.
Step 1: Inspect Rendered JSON-LD
Fetch a live course page and isolate schema output:
curl -s https://example.com/courses/intro-to-financial-modeling/ | grep -o '<script type="application/ld+json">.*</script>'
If the site compresses output aggressively, save the page and inspect it locally:
curl -s https://example.com/courses/intro-to-financial-modeling/ -o /tmp/course-page.html
grep -n 'application/ld+json' /tmp/course-page.html
Look for:
- More than one `image` property for the same course entity
- An `ImageObject` with the wrong asset
- Attachment page URLs
- Empty width and height values
Step 2: Validate The Featured Image Record
Check what WordPress thinks the course thumbnail is:
wp post meta get 482 _thumbnail_id
wp post get 482 --field=post_type
wp media get 913 --fields=ID,url,title,status
Expected output:
ID: 913
url: https://example.com/wp-content/uploads/2026/04/course-cover.webp
title: Financial Modeling Masterclass Cover
status: inherit
If the returned media item is wrong, fix the featured image assignment in WordPress first. Schema should not be used to patch a broken content model.
Step 3: Override The Schema Image When Needed
If your SEO plugin exposes filters, use them instead of editing plugin core files. For Yoast-based stacks, a targeted filter in a small mu-plugin is the safer route:
<?php
/**
* Plugin Name: Course Schema Image Fix
*/
add_filter('wpseo_schema_graph_pieces', function ($pieces, $context) {
return $pieces;
}, 10, 2);
add_filter('wpseo_schema_webpage', function ($data) {
if (!is_singular('sfwd-courses')) {
return $data;
}
$image_id = get_post_thumbnail_id();
$image = wp_get_attachment_image_src($image_id, 'full');
if ($image) {
$data['primaryImageOfPage'] = [
'@type' => 'ImageObject',
'url' => $image[0],
'width' => (int) $image[1],
'height' => (int) $image[2],
];
}
return $data;
});
Save that in:
wp-content/mu-plugins/course-schema-image-fix.php
Step 4: Re-Test The Output
After deployment, clear all page caches, object cache, and CDN cache if present. Then re-fetch the page and validate again.
A quick verification checklist:
- Open one course URL.
- Confirm only one primary course image is present in JSON-LD.
- Confirm the URL returns `200 OK` publicly.
- Confirm width and height are numeric.
- Re-run Google Rich Results Test or Schema Markup Validator.
Troubleshooting
What follows are the real failure cases that usually waste the most time on WordPress course builds, because the visible page looks correct while the schema layer is still wrong.
LMS Archive Image Replaces Single Course Image
Some LMS themes reuse archive card data on the single course template. That can cause schema to point at a smaller listing thumbnail rather than the course hero image.
Fix:
- Inspect the single course template override in the child theme
- Check whether `get_the_post_thumbnail_url($post, 'medium')` is being used in schema logic
- Replace it with `full` size and bind it to the current singular post ID
CDN URL Works In Browser But Fails Validation
This usually happens when the image URL is signed, short-lived, or blocked from unknown crawlers. A course page may render fine for users while schema validators fail.
Fix:
- Open the exact schema image URL in a private browser window
- Check headers with `curl -I`
- Remove expiring query strings from schema output
- Prefer a stable media URL on the site domain or a crawlable CDN origin
Command:
curl -I https://cdn.example.com/course-images/cover.webp
Bad signs include `403 Forbidden`, redirect loops, or cache keys that expire within minutes.
Two SEO Plugins Publish Competing Image Schema
It is still common to find Yoast left active after Rank Math or another schema plugin was installed for a course launch. Both can output valid-looking JSON-LD, but Google may choose the wrong graph.
Fix:
- Deactivate the redundant schema source
- Clear cached HTML
- Compare page source before and after
- Keep one plugin responsible for schema and social image metadata
You can verify active SEO plugins with:
wp plugin list --status=active | grep -Ei 'seo|schema|rank|yoast'
Conclusion
Fixing incorrect image schema markup in WordPress for online course platforms is mostly about consistency, not complexity. Choose one schema source, make the course featured image authoritative, ensure the final URL is public and stable, and validate the rendered JSON-LD instead of trusting admin settings alone. Course sites tend to drift because LMS plugins, SEO plugins, image CDNs, and custom templates all touch the same data. If you lock those layers down and keep image handling predictable, rich results become much easier to maintain. For adjacent cleanup work, the tools and guidance on Media Optimizer, Alt Text Checker, and AI Media Alt Creator are practical next steps.