Skip to content

Commit 5eaff81

Browse files
jack-arturoclaude
andcommitted
Register project meta fields for REST API access
Added register_post_meta() calls for _minimalcode_project_url, _minimalcode_github_url, and _minimalcode_role to enable setting these fields via the WordPress REST API. Also added 'custom-fields' to post type supports array. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent fc5d154 commit 5eaff81

1 file changed

Lines changed: 32 additions & 1 deletion

File tree

inc/post-types.php

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,42 @@ function minimalcode_register_post_types() {
3535
'has_archive' => true,
3636
'query_var' => true,
3737
'rewrite' => array( 'slug' => 'projects' ),
38-
'supports' => array( 'title', 'excerpt', 'thumbnail', 'editor' ),
38+
'supports' => array( 'title', 'excerpt', 'thumbnail', 'editor', 'custom-fields' ),
3939
'menu_icon' => 'dashicons-portfolio',
4040
'show_in_rest' => true,
4141
)
4242
);
43+
44+
// Register meta fields for REST API access.
45+
register_post_meta(
46+
'projects',
47+
'_minimalcode_project_url',
48+
array(
49+
'type' => 'string',
50+
'single' => true,
51+
'show_in_rest' => true,
52+
)
53+
);
54+
55+
register_post_meta(
56+
'projects',
57+
'_minimalcode_github_url',
58+
array(
59+
'type' => 'string',
60+
'single' => true,
61+
'show_in_rest' => true,
62+
)
63+
);
64+
65+
register_post_meta(
66+
'projects',
67+
'_minimalcode_role',
68+
array(
69+
'type' => 'string',
70+
'single' => true,
71+
'show_in_rest' => true,
72+
)
73+
);
4374
}
4475

4576
add_action( 'add_meta_boxes', 'minimalcode_project_meta_boxes' );

0 commit comments

Comments
 (0)