禁用 WordPress 4.7 版本新增的PDF缩略图预览功能

前端之家收集整理的这篇文章主要介绍了禁用 WordPress 4.7 版本新增的PDF缩略图预览功能前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

wordpress 4.7 版本新增了一个PDF缩略图生成和预览的功能,当您上传完PDF格式的文件以后,会自动生成这个PDF文件缩略图,并显示预览,如下图所示:

但是如果您已经在使用其他的PDF插件实现了类似的功能,并且不希望与这个新增的功能有冲突,您可能希望禁用掉 wordpress 4.7 版本新增的PDF缩略图预览功能

实现的方法很简单,切换到主题目录,打开 functions.PHP 文件添加以下代码即可:

Crayon-5c891cb72dc63513843793" class="Crayon-Syntax Crayon-theme-classic Crayon-font-monaco Crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouSEOver" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
Crayon-toolbar" data-settings=" mouSEOver overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">Crayon-title">functions.PHP
Crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
Crayon-button Crayon-nums-button" title="Toggle Line Numbers">
Crayon-button-icon">
Crayon-button Crayon-plain-button" title="Toggle Plain Code">
Crayon-button-icon">
Crayon-button Crayon-wrap-button" title="Toggle Line Wrap">
Crayon-button-icon">
Crayon-button Crayon-expand-button" title="Expand Code">
Crayon-button-icon">
Crayon-button Crayon-copy-button" title="Copy">
Crayon-button-icon">
Crayon-button Crayon-popup-button" title="Open Code In New Window">
Crayon-button-icon">
Crayon-language">PHP
Crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
Crayon-plain-wrap">
Crayon-main" style="">Crayon-table">Crayon-row">
Crayon-nums " data-settings="show">
Crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
Crayon-num" data-line="Crayon-5c891cb72dc63513843793-1">1
Crayon-num Crayon-striped-num" data-line="Crayon-5c891cb72dc63513843793-2">2
Crayon-num" data-line="Crayon-5c891cb72dc63513843793-3">3
Crayon-num Crayon-striped-num" data-line="Crayon-5c891cb72dc63513843793-4">4
Crayon-num" data-line="Crayon-5c891cb72dc63513843793-5">5
Crayon-code">
Crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
Crayon-line" id="Crayon-5c891cb72dc63513843793-1">Crayon-t">functionCrayon-h"> Crayon-e">wpb_disable_pdf_previewsCrayon-sy">(Crayon-sy">)Crayon-h"> Crayon-sy">{Crayon-h">
Crayon-line Crayon-striped-line" id="Crayon-5c891cb72dc63513843793-2">Crayon-h">Crayon-v">$fallbacksizesCrayon-h"> Crayon-o">=Crayon-h"> Crayon-t">arrayCrayon-sy">(Crayon-sy">)Crayon-sy">;Crayon-h">
Crayon-line" id="Crayon-5c891cb72dc63513843793-3">Crayon-h">Crayon-k ">returnCrayon-h"> Crayon-v">$fallbacksizesCrayon-sy">;Crayon-h">
Crayon-line Crayon-striped-line" id="Crayon-5c891cb72dc63513843793-4">Crayon-sy">}Crayon-h">
Crayon-line" id="Crayon-5c891cb72dc63513843793-5">Crayon-e">add_filterCrayon-sy">(Crayon-s">'fallback_intermediate_image_sizes'Crayon-sy">,Crayon-h"> Crayon-s">'wpb_disable_pdf_previews'Crayon-sy">)Crayon-sy">;

修改以后当您再次上传完PDF文件之后,插入界面如下图所示:

感兴趣的朋友可以尝试着用上面的方法禁用 wordpress 4.7 版本新增的PDF缩略图预览功能

参考出自:wordpress/" href="http://www.wpbeginner.com/wp-tutorials/how-to-disable-pdf-thumbnail-previews-in-wordpress/" target="_blank" rel="nofollow">http://www.wpbeginner.com/wp-tutorials/how-to-disable-pdf-thumbnail-previews-in-wordpress/

原文链接:https://www.f2er.com/wordpress/238360.html

猜你在找的wordpress相关文章