您可以(而且应该)始终过滤WP\\u REST\\u API的输出。
add_filter(\'json_prepare_post\', \'change_this_into_a_proper_function_name\', 999);
function change_this_into_a_proper_function_name($post){
// hack and slash into your $post here. This is a regular WP_Post
// add custom fields and tax terms you might need, remove what
// you don\'t want to expose to app or are never going to need...
// This filtering step is actually a must imho, as it really influences
// the speed at which your posts will load over poor connections.
// Special care should be taken with attachments, I usually replace them
// with versions of 800px width (or even 600) for both Android and IoS.
return $post;
}
我唯一没有完全删除的应用程序
$post->content
支持该摘录的是一款书店应用程序,用户安装该应用程序是为了阅读书评。但即使在那里,当我提取评论列表时,我也会过滤掉内容,只会将其完全加载到
read more
. 它得到了回报。即使在资源匮乏的设备上,该应用程序也保持了敏捷性。