Я использовал приведенный ниже код, но он не работает должным образом, в приложении отображается пользовательский заголовок и короткий код одного изображения. Может ли кто-нибудь помочь мне, как исправить мою проблему. Спасибо.
add_action( 'rest_api_init', function ()
{
register_rest_field(
// if you need it to work with other (even custom post) types,
// then you have to use an array:
// array( 'page', 'post', 'custom_post_type', 'etc' )
// this example only does the trick for 'page'
// look at the link in the first EDIT section of this answer
'page',
'content',
array(
'get_callback' => 'compasshb_do_shortcodes',
'update_callback' => null,
'schema' => null,
)
);
});
function compasshb_do_shortcodes( $object, $field_name, $request )
{
WPBMap::addAllMappedShortcodes(); // This does all the work
global $post;
$post = get_post ($object['id']);
$output['rendered'] = apply_filters( 'the_content', $post->post_content );
return $output;
}