当前位置:网站首页>How to replace or disable the default blue favicon ICO Icon
How to replace or disable the default blue favicon ICO Icon
2022-06-10 01:53:00 【Shell railing】
Recently Wordpress Upgrade the program to 5.6.2 edition , Find front and back office favicon.ico Different icons . The new version will automatically determine , If your WordPress The website is not set favicon.ico Icon , Will display a default Blue logo Icon .
Maybe we are the same as me , I don't like the default favicon.ico Icon , In appearance - Customize , Upload an icon to “ Site identity ” Under the site icon option ; This is because WordPress You will first judge whether you have set this option , If it's set up , The icon you set will be displayed .
Ban WordPress default favicon.ico Icon
We can go through do_faviconico Hook modification WordPress The logic of , To disable the default icon , That is, if the user does not set “ Site icons ”, In the background page , Do not show default WordPress logo Small icons .
Just add the following code to the currently used topic functions.php in , Then empty your browser cache , Force refresh or open a browser that has not visited your site , And you can see the effect .
// Ban WordPress default favicon.ico Icon
add_action( 'do_faviconico', function() {
//Check for icon with no default value
if ( $icon = get_site_icon_url( 32 ) ) {
//Show the icon
wp_redirect( $icon );
} else {
//Show nothing
header( 'Content-Type: image/vnd.microsoft.icon' );
}
exit;
} );WordPress The foreground and background assignments are different favicon.ico Icon
Copy and paste the following code into the topic functions.php file :
//WordPress The foreground and background assignments are different favicon.ico Icon
if ( !function_exists( 'wp_admin_favicon' ) ) {
function wp_admin_favicon() {
echo '<link rel="shortcut icon" href="'.get_bloginfo(%20"template_directory" ).'/images/favicon.ico">';
}
}
add_action( 'admin_head', 'wp_admin_favicon' );favicon.ico Put the icon in the theme folder images Under the directory .
边栏推荐
- Is Haitong Securities safe
- 【LeetCode】114. 二叉树展开为链表
- Redis advanced knowledge points (can be learned, reviewed and interviewed)
- D materialize function parameters
- 你不会还在用Xshell吧?这款开源的终端工具才是yyds!
- [program life] "stage summary" - at a loss
- Sword finger offer 10- ii Frog jumping on steps
- [proteus simulation] 51 single chip microcomputer +lcd1602+ external memory calculator
- 自定义操作日志记录注解
- [leetcode] edit distance
猜你喜欢

The idea version of postman comes out, which is easy to test and use

Industrial practice example of industrial defect detection based on openvino deployment
Beyond compare 3 key serial number sharing and key revocation solutions

服务器停止响应是什么意思,该如何排查?
[email protected] 项目实训"/>[email protected] 项目实训

Leetcode 700: search in binary search tree

NACK of webrtc's audio weak network countermeasure

51 single chip microcomputer learning record (VI) IIC, ADC part

【图像分类案例】(10) Vision Transformer 动物图像三分类,附Pytorch完整代码
[email protected] Project training"/>[email protected] Project training
随机推荐
My eclipse connection database
[apprendre la programmation FPGA à partir de zéro - 16]: chapitre de démarrage rapide - Étapes 2 - 4 - Verilog HDL Language Description Language Basic Syntax (both Software programmers and Hardware En
Use primecache to speed up your computer!
Linux安装MySQL脚本
【LeetCode】114. 二叉树展开为链表
[Multisim Simulation] differential proportional amplifier circuit
【LeetCode】437. Path sum III
牛客网——华为题库(1~10)
Operation and maintenance thinking | do you know the relationship between CMDB and monitoring?
Introduction à la définition et au calcul de la variance Allan
2022年制冷与空调设备运行操作复训题库模拟考试平台操作
【LeetCode】338. 比特位计数
Which of DV and ov SSL certificates is suitable for purchase on the company's website
IDEA 版 Postman问世,亲测好用
两道软件测试题目
D materialize function parameters
Innftnews | l'avenir de NFT dans l'économie web3
Nodejs reported an internal error typeerror: cannot read property 'destroy' of undefined
Regular expression does not contain a string
Leetcode 98: validate binary search tree