我注意到Wordpress会在header中生成2个链接。它们包含一些oembed参数。
这看起来像这样:
<link rel="alternate" type="application/json+oembed" href="......">
<link rel="alternate" type="text/xml+oembed" href=".......">
{
"version": "1.0",
"provider_name": "Website Name",
"provider_url": "http://example.com",
"author_name": "admin",
"author_url": "http://example.com/author/admin/",
"title": "",
"type": "rich",
"width": 600,
"height": 338,
"html": "long string of html"
}我知道我可以禁用这些链接,但我想保留它们,只删除author_name和author_url。
有什么办法可以做到这一点吗?
希望你能帮上忙。
谢谢。
发布于 2019-09-21 03:48:17
保留rel链接并过滤数组数据:
function filter_oembed_response_data_author( $data, $post, $width, $height ) {
//print_r($data);
unset($data['author_name']);
unset($data['author_url']);
return $data;
};
add_filter( 'oembed_response_data', 'filter_oembed_response_data_author', 10, 4 );您可以转到您的一个rel链接,取消注释print_r,并通过操作$data数组来添加、编辑或删除条目。
https://stackoverflow.com/questions/54907869
复制相似问题