admin管理员组文章数量:1287878
I'm doing my site with two pieces -- the headless CMS on a subdomain where content is entered, and the root domain where I display data. Only WP is installed in the subdomain, not the root domain. In the subdomain, I created a custom post type called Staff, and then items inside are a Member. I noticed that I can't use the URL...
(WP REST API)
...to read these items. Looking in the docs, I see that I can address it as...
When I use /staff, it shows me the core post fields, but not any of the custom field groups. (Note, I'm using the Custom Post Types plugin from TotalPress.)
How do I get a given staff member's custom field properties on their record? I can access someone such as:
/?slug=john-smith
...but there are no custom fields in there that I attached to this record.
How do I use the REST API to get the custom fields attached to a custom post type?
I'm doing my site with two pieces -- the headless CMS on a subdomain where content is entered, and the root domain where I display data. Only WP is installed in the subdomain, not the root domain. In the subdomain, I created a custom post type called Staff, and then items inside are a Member. I noticed that I can't use the URL...
https://example/wp-json/wp/v2/posts
(WP REST API)
...to read these items. Looking in the docs, I see that I can address it as...
https://example/wp-json/wp/v2/staff
When I use /staff, it shows me the core post fields, but not any of the custom field groups. (Note, I'm using the Custom Post Types plugin from TotalPress.)
How do I get a given staff member's custom field properties on their record? I can access someone such as:
https://example/wp-json/wp/v2/staff/?slug=john-smith
...but there are no custom fields in there that I attached to this record.
How do I use the REST API to get the custom fields attached to a custom post type?
Share Improve this question edited Sep 13, 2021 at 4:21 Volomike asked Sep 12, 2021 at 23:50 VolomikeVolomike 1,8652 gold badges18 silver badges20 bronze badges 5 |1 Answer
Reset to default 0I found the fix without code. I installed the Rest API Helper Plugin and it now exposed the custom fields on a given post type.
本文标签: How To Read Read Custom Post Type Data in Headless CMS Mode
版权声明:本文标题:How To Read Read Custom Post Type Data in Headless CMS Mode 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741324428a2372392.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
show_in_rest
set to true, but because you used a plugin to build your post types that solution is unavailable to you. Having said that, custom post types are straight forward and there are code generators online that write the code for you based on inputs and checkboxes. You don't need a plugin to auto-register post types for you – Tom J Nowell ♦ Commented Sep 13, 2021 at 9:18