WordPress 4.7 新增瞭一個PDF縮略圖生成和預覽功能,上傳PDF文件後,會自動生成這個PDF文件的縮略圖,並顯示預覽,如下圖:
但是如果你已經在使用其他PDF外掛實現瞭類似的功能,並且不希望與這個新增的功能有沖突,你可能想要禁用掉 WordPress 4.7 新增的PDF縮略圖預覽功能。實現的方法很簡單,在你當前主題的 functions.php 文件添加如下代碼即可:
1 2 3 4 5 6 7 8 9 |
/** * Disable PDF Thumbnail Previews in WordPress * http://www.wpbeginner.com/wp-tutorials/how-to-disable-pdf-thumbnail-previews-in-wordpress/ */ function wpb_disable_pdf_previews() { $fallbacksizes = array(); return $fallbacksizes; } add_filter('fallback_intermediate_image_sizes', 'wpb_disable_pdf_previews'); |
/**
* Disable PDF Thumbnail Previews in WordPress
* http://www.wpbeginner.com/wp-tutorials/how-to-disable-pdf-thumbnail-previews-in-wordpress/
*/
function wpb_disable_pdf_previews() {
$fallbacksizes = array();
return $fallbacksizes;
}
add_filter(‘fallback_intermediate_image_sizes’, ‘wpb_disable_pdf_previews’);
然後你上傳PDF文件後,插入界面如下圖所示:
參考出自:http://www.wpbeginner.com/wp-tutorials/how-to-disable-pdf-thumbnail-previews-in-wordpress/