favicon and multi site

I would use a rewrite to map requests for /favicon.ico to /icons/example.com.ico: RewriteCond %{REQUEST_URI} ^/favicon\.ico RewriteCond %{SERVER_NAME} ^(www\.)?([a-z0-9]+) RewriteCond %{DOCUMENT_ROOT}/icons/%2.ico -f RewriteRule . /icons/%2.ico [L] Note the regex for line #2 depends on your set-up – is each website its own domain, or a subdomain/subdirectory of a primary domain? I would also place a default … Read more

How to change in customizer the “site identity” tab required capabilities

This is how I’ve interpreted from the wordpress docs at least. Originally these settings were made with add_setting and it is where the capability was originally set. Fortunately, we can use get_setting to change that value. It seems to work very well for your case. function wpseo_206907_add_back_customizer_controls_for_not_admins( $wp_customize ) { $wp_customize->get_setting( ‘blogname’ )->capability = ‘edit_theme_options’; … Read more

Check if Favicon is set in Customizer

WordPress saves the Favicon as site_icon in the options table holding the attachment post ID. What you could do is something like this: if( false === get_option( ‘site_icon’, false ) ) { // Show favicon } Where get_option() will hit the default ( we provide as the 2nd parameter ) false IF the site_icon does … Read more

Conditional Logic to Check for Site Icon

There exists a special function to check if the site icon is set, namely the has_site_icon() function. So you could try: add_action( ‘wp_head’, ‘wpse_default_site_icon’, 99 ); add_action( ‘login_head’, ‘wpse_default_site_icon’, 99 ); function wpse_default_site_icon() { if( ! has_site_icon() && ! is_customize_preview() ) { // your default icons here } } The case when the site icon … Read more

Favicon storage – which folder should be used?

I would only store it in the theme folder if I expected the favicon to change when I change the theme. Which I don’t. A favicon is part of the total site identity, not a function of the CMS. What if you use non-WP software to run different parts of the site — e.g., a … Read more

What’s the proper way to add a favicon in WordPress without a plugin? [closed]

I usually put the icons in an images folder inside my theme so I’d use function kia_add_favicon(){ ?> <!– Custom Favicons –> <link rel=”shortcut icon” href=”https://wordpress.stackexchange.com/questions/43928/<?php echo get_stylesheet_directory_uri();?>/images/favicon.ico”/> <link rel=”apple-touch-icon” href=”<?php echo get_stylesheet_directory_uri(); ?>/apple-touch-icon.png”> <?php } add_action(‘wp_head’,’kia_add_favicon’); edited: to add the apple touch icon per the comment, and to clarify that if you are using … Read more

How to display .ico files in the media library

Update: It looks like this will be supported in 5.0+. See ticket #43458 The default This is how the favicon (.ico) files show up in the Media Grid view: This is the corresponding part of the micro template: <# } else if ( ‘image’ === data.type && data.sizes ) { #> <div class=”centered”> <img src=”https://wordpress.stackexchange.com/questions/177981/{{ … Read more