0
我想输出WP Job Manager插件的job_listing的自定义字段。 我试过这个帖子:https://wordpress.org/support/topic/rest-api-integration-with-wp-job-manager/而且这个字段总是为空。如何在Wordpress中为自定义帖子类型显示JSON响应中的自定义字段?
我试图返回一个硬编码的字符串,但该字段再次为空。
add_action('rest_api_init', function() {
register_rest_field('job_listing', 'geolocation_city', array(
'get_callback' => function($job_listing) {
return "YO";
},
'update_callback' => null,
'schema' => null
));
});
请标记您的答案,如果解决了问题 –