Search code examples
jsonwordpresswordpress-themingschemajsonschema

Missing Schema for WordPress theme.json


According to the docs, one can simple add

$schema": "https://schemas.wp.org/trunk/theme.json",

to the beginning of the JSON file to load the schema

VS code gives me the error that it's missing:

vs code error

And sure enough, going to https://schemas.wp.org/trunk/theme.json it doesn't exist:

site missing

I've seen posts such as this one about missing schema which says to go to https://schemas.wp.org/wp/5.9/theme.json but same result. Searching around it seems like their security certificate expired at some point, but surely they resolved that many months ago.

I'd like to resolve this to get the benefits of schema (autocomplete / intellisense) in the file, especially since the file is getting larger and this is a large project with multiple people working on it.

Help appreciated.


Solution

  • It seems like https://schemas.wp.org/trunk/theme.json is not reachable for you even though it is online (I can reach the URL). The url forwards to https://raw.githubusercontent.com/WordPress/gutenberg/trunk/schemas/json/theme.json, where the actual JSON file is located, which might be accessible for you. If yes, you can add this direct url as the value for $schema.