How to correctly create Custom Post Type with custom fields through WP REST API V2

非 Y 不嫁゛ 提交于 2019-12-03 08:07:53

There was a glaringly obvious problem with my wordpress plugin where the add action function name did not match the actual function name register_something_random and slug_register_something_random()

add_action( 'rest_api_init', 'register_something_random' );
function slug_register_something_random() {

Should be

add_action( 'rest_api_init', 'register_something_random' );
function register_something_random() {

Made this change and all is now ok

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!