Files
peptide-repo-core/tests
peptiderepo 0bbb75fd26 fix(schema): v0.6.2 — move Drug/FAQ injection to wpseo_schema_graph; fix peptide 500
Root cause: inject_graph_pieces() added plain PHP arrays to wpseo_schema_graph_pieces.
Yoast Schema_Generator::filter_graph_pieces_to_generate() calls get_class() +
is_needed() on every piece expecting Abstract_Schema_Piece objects — a plain array
produces: PHP Fatal: get_class(): Argument #1 ($object) must be of type object,
array given. All peptide monograph pages returned HTTP 500; non-peptide pages were
unaffected (is_singular guard).

Fix: remove wpseo_schema_graph_pieces hook entirely. New inject_graph_nodes() method
hooks wpseo_schema_graph at priority 12 (after enrich_webpage_piece at 11), which
receives the fully-assembled graph as array-of-arrays — safe for plain array appends.

Also adds regression test (test-jsonld-peptide-piece.php) that:
- Reproduces the v0.6.1 get_class(array) TypeError (fails-before)
- Confirms inject_graph_nodes Drug+FAQ emission is correct (passes-after)

Agent-Session: jsonld-peptide-piece-fix v0.6.2
2026-06-13 07:12:46 +00:00
..