fix(jsonld): accept string|array @type — v0.6.1

Yoast's wpseo_schema_webpage_type filter passes ['WebPage'] (array) on
every singular page. The v0.6.0 retype_to_medical_webpage() signature
was strict string, causing TypeError → HTTP 500 on ALL singulars under
strict_types=1. Secondary bug: enrich_webpage_piece compared
'WebPage' === $piece['@type'] but @type is an array, so MedicalWebPage
enrichment never injected.

Fix:
- retype_to_medical_webpage: string|array param + return (PHP 8.1+ union)
- enrich_webpage_piece: normalise @type to array before in_array() check
- Add tests/unit/test-jsonld-webpage.php: regression tests with array
  input for both code paths; fail against v0.6.0, pass after fix
- Bump version header + PR_CORE_VERSION constant to 0.6.1
- CHANGELOG entry under [0.6.1]

Agent-Session: jsonld-webpage-typefix v0.6.1
This commit is contained in:
peptiderepo
2026-06-13 06:44:00 +00:00
parent e9d97b51e2
commit 077c4b0e51
4 changed files with 192 additions and 9 deletions

View File

@@ -3,7 +3,7 @@
* Plugin Name: Peptide Repo Core
* Plugin URI: https://peptiderepo.com
* Description: Canonical peptide schema — shared data layer for the peptiderepo.com ecosystem. Provides the peptide CPT, dosing rows, legal status cells, AI candidate queue, disclaimer component, and JSON-LD output.
* Version: 0.6.0
* Version: 0.6.1
* Author: peptiderepo
* Author URI: https://peptiderepo.com
* License: GPL-2.0-or-later
@@ -22,7 +22,7 @@ if ( ! defined( 'ABSPATH' ) ) {
/* ── Constants ────────────────────────────────────────────────────────── */
define( 'PR_CORE_VERSION', '0.6.0' );
define( 'PR_CORE_VERSION', '0.6.1' );
define( 'PR_CORE_PLUGIN_FILE', __FILE__ );
define( 'PR_CORE_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
define( 'PR_CORE_PLUGIN_URL', plugin_dir_url( __FILE__ ) );