有一些站長很是疑惑,在編輯文章時插入自己網(wǎng)站的鏈接,發(fā)布后會變成一張卡片,雖然挺有意思的,但也對一些主題的布局產(chǎn)生了困擾,這一節(jié)的wordpress開發(fā)就教大家怎么禁用卡j片嵌入式內(nèi)鏈 Post Embed 功能。
從 2015 年底 wordpress4.4 版本起,官方默認開啟了對其支持(開啟)。畢竟無論是 InsTagram、FaceBook 還是 Twitter 都在使用這個 Embed posts ,也著實是非常喜歡。

卡片嵌入式內(nèi)鏈效果如下:

如何禁用?
在主題根目錄下的functions.php
的<?php
下添加以下代碼:
remove_action('rest_api_init', 'wp_oembed_register_route');
remove_filter('rest_pre_serve_request', '_oembed_rest_pre_serve_request', 10, 4);
remove_filter('oembed_dataparse', 'wp_filter_oembed_result', 10 );
remove_filter('oembed_response_data', 'get_oembed_response_data_rich', 10, 4);
remove_action('wp_head', 'wp_oembed_add_discovery_links');
remove_action('wp_head', 'wp_oembed_add_host_js');
如果你查看網(wǎng)頁源代碼,你的主題head標簽中加載了大量你不知是啥的文件,可以跟著這篇wordpress開發(fā)教程一起來認識一下,還可以講他們?nèi)サ簦?/p>