From 3050292fcf0e82eb8647f08f70a0a90d38113522 Mon Sep 17 00:00:00 2001 From: peptiderepo <273788462+peptiderepo@users.noreply.github.com> Date: Sat, 25 Apr 2026 01:57:30 +0700 Subject: [PATCH] fix(cpt): remove rest_namespace so Gutenberg block editor can load peptide posts (v0.3.2) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Removes rest_namespace => pr-core/v1 from CPT registration. Gutenberg fetches wp/v2 hardcoded — custom namespace caused 404 and editor crash on all 89 peptide entries. WordPress defaults to wp/v2. QA: PASS (2026-04-25-9d4ce64c.md) CI: green PR: #5 --- CHANGELOG.md | 5 +++++ includes/cpt/class-pr-core-peptide-cpt.php | 3 ++- peptide-repo-core.php | 4 ++-- tests/unit/test-peptide-cpt.php | 4 ++-- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ab29f7a..1ab47b2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,11 @@ All notable changes to Peptide Repo Core are documented here. Format: [Semantic Versioning](https://semver.org/). +## [0.3.2] — 2026-04-25 + +### Fixed +- Remove `rest_namespace` from peptide CPT registration. Custom namespace prevented Gutenberg block editor from loading peptide posts for editing (404 on wp/v2 REST route). All 89 peptide entries are now editable in the block editor. (#5) + ## [0.3.1] — 2026-04-24 ### Fixed diff --git a/includes/cpt/class-pr-core-peptide-cpt.php b/includes/cpt/class-pr-core-peptide-cpt.php index 3572463..dd1dce2 100644 --- a/includes/cpt/class-pr-core-peptide-cpt.php +++ b/includes/cpt/class-pr-core-peptide-cpt.php @@ -184,7 +184,8 @@ class PR_Core_Peptide_CPT { 'show_in_nav_menus' => true, 'show_in_rest' => true, 'rest_base' => 'peptides', - 'rest_namespace' => 'pr-core/v1', + // 'rest_namespace' omitted — custom namespaces break Gutenberg + // (it fetches wp/v2 hardcoded). WordPress defaults to wp/v2. (#5) 'menu_position' => 25, 'menu_icon' => 'dashicons-database', 'capability_type' => 'post', diff --git a/peptide-repo-core.php b/peptide-repo-core.php index 8647391..7f1a5ee 100644 --- a/peptide-repo-core.php +++ b/peptide-repo-core.php @@ -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.3.1 + * Version: 0.3.2 * 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.3.1' ); +define( 'PR_CORE_VERSION', '0.3.2' ); define( 'PR_CORE_PLUGIN_FILE', __FILE__ ); define( 'PR_CORE_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); define( 'PR_CORE_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); diff --git a/tests/unit/test-peptide-cpt.php b/tests/unit/test-peptide-cpt.php index e4c0582..ed861bb 100644 --- a/tests/unit/test-peptide-cpt.php +++ b/tests/unit/test-peptide-cpt.php @@ -10,7 +10,7 @@ * - TAX_FAMILY constant is removed. * - register_peptide_post_type() guard: no-op when post_type_exists returns true. * - register_peptide_post_type() payload: args match the harmonized contract - * (thumbnail in supports, rewrite slug peptides, pr-core/v1 REST namespace). + * (thumbnail in supports, rewrite slug peptides, rest_namespace absent — Gutenberg requires wp/v2). * - register_taxonomies() guard: no-op when taxonomy_exists returns true. * - register_taxonomies() only registers peptide_category; pr_peptide_family is gone. * @@ -65,7 +65,7 @@ pr_assert_equals( true, $args['public'] ?? null, 'public = true' ); pr_assert_equals( true, $args['publicly_queryable'] ?? null, 'publicly_queryable = true' ); pr_assert_equals( true, $args['show_in_rest'] ?? null, 'show_in_rest = true' ); pr_assert_equals( 'peptides', $args['rest_base'] ?? null, 'rest_base = "peptides"' ); -pr_assert_equals( 'pr-core/v1', $args['rest_namespace'] ?? null, 'rest_namespace = "pr-core/v1"' ); +pr_assert( ! array_key_exists( 'rest_namespace', $args ), 'rest_namespace absent — defaults to wp/v2 (Gutenberg requirement)' ); pr_assert_equals( 'post', $args['capability_type'] ?? null, 'capability_type = "post"' ); pr_assert_equals( true, $args['map_meta_cap'] ?? null, 'map_meta_cap = true' ); pr_assert_equals( false, $args['hierarchical'] ?? null, 'hierarchical = false' );