Yoast / Yoast/developer

Add images to your Article Schema throws fatal error

Open
#308 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
15
Forks
23
PR merge metrics
No merged PRs in 30d

Description

Please give us a description of the issue

When I use the filter wpseo_schema_article and use the example code provided here, I see fatal error.

Steps to replicate:

  1. I used the code snippet plugin to add the example code.
  2. Changed the value of $attachment_id in the example. I added an image and used the ID for that image
  3. Then I saved the code and activated it.
  4. I checked a post where I set schema type as webpage and page type as article. I noticed fatal error in the page source that says: WPSEO_Schema_Image is not found.

Screenshot:
Screenshot 2024-06-22 at 4 02 34 PM

  • I've read and understood the contribution guidelines.
  • I've searched for any related issues and avoided creating a duplicate issue.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the “Add images to your Article Schema” example linked in the issue and reproduce it using the reported filter, attachment ID, and Article schema settings. Check why the example refers to WPSEO_Schema_Image, then update the documented example so it no longer produces the reported fatal error and verify the generated page source.

Written by the indexing model from the issue text.

Assessment

Tech stack
wordpress
Domain
documentation
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.