diff --git a/tools/av-bricks-rest-bridge.php b/tools/av-bricks-rest-bridge.php index 8987e79..cc9ba63 100644 --- a/tools/av-bricks-rest-bridge.php +++ b/tools/av-bricks-rest-bridge.php @@ -20,20 +20,21 @@ defined('ABSPATH') || exit; ---------------------------------------------------------------- */ add_filter('register_post_type_args', function ($args, $post_type) { - $needs_rest = ['bricks_template', 'case_study', 'scenario']; + // bricks_template intentionally excluded : touching its supports/show_in_rest + // breaks Bricks's own builder (it expects the original registration verbatim). + // The MCP server doesn't need REST access to templates anyway — we use direct + // PHP scripts to manage them. Only case_study + scenario stay REST-exposed. + $needs_rest = ['case_study', 'scenario']; if (! in_array($post_type, $needs_rest, true)) { return $args; } $args['show_in_rest'] = true; - $args['rest_base'] = $post_type === 'bricks_template' ? 'bricks_template' : ($post_type . 's'); + $args['rest_base'] = $post_type . 's'; $args['rest_controller_class'] = 'WP_REST_Posts_Controller'; - // Only ADD 'custom-fields' (required so /wp/v2/ exposes the meta field). - // Do NOT add 'editor' or override the whole supports array — that breaks the - // Bricks builder for bricks_template (Bricks's CPT supports = author/revisions/ - // thumbnail/title — no 'editor', deliberately). + // Only add 'custom-fields' so the meta field is exposed via REST. $existing_supports = $args['supports'] ?? []; if (! in_array('custom-fields', $existing_supports, true)) { $existing_supports[] = 'custom-fields';