If you have a modern theme, where you can upload a favicon with the theme customizer (rather than a hardcoded url in the header.php
), you can simply use a filter. Take a look at the function get_site_icon
. As you can see it returns the url of the image that you have uploaded using the customizer. However, before it does so, it runs it through a filter, allowing you to change it under any condition you would like. For instance, to change it when you are on a page with ID=3:
add_filter( 'get_site_icon_url','wpse318165_filter_favicon', 10, 3 );
function wpse318165_filter_favicon ($url, $size, $blog_id) {
global $post;
if ( is_page( 3 ) ) $url="path-to-other-favicon";
return $url;
}
Related Posts:
- Arrange Category post manually when displayed
- How do I make an HTML table from a database table?
- How to get the custom header image’s alt text?
- Modify previous and next text from pagination links
- Correct regex for wp_embed_register_handler
- How does wordpress know which site to setup (on multisite)?
- WordPress custom taxonomy description for each post?
- Network installation giving errors when viewing or adding a user
- Calling a method from functions.php on a click of a button
- Conditional statement for parent, child and grandchild pages
- Fix 403 error on WordPress multisite network using subdomains
- Two posts in same div – WP loop
- How to add a post or page tag to the list of classes appearing in the body tag’s class attribute?
- How to create Sub Sub domain Multi User blogs?
- HTML table from shortcode with multiple parameters
- Why am I getting ERR_NAME_NOT_RESOLVED when I add a site to my multisite installation? [closed]
- To echo or not to echo?
- Custom php page outside the scope of my theme
- Correct syntax to html php conversion
- Add itemprop Schema.org Markup to li Elements in wp_nav_menu
- Adding hreflang tags automatically in WordPress subdirectory multisite
- How Display Posts on category
- ACF page while loop breaks footer while loop
- Getting a specific post values to another div or modal
- How to change home or site url using action hooks or filter?
- search and replace preword from author
- Embed html in php code
- WP grandchild categories in nested ul li
- Customize position of social icons in upme plugin [closed]
- Settings API callback function inserts html quotes from nowhere
- NGINX rewrite rules for multisite
- How create a Shortcode with hover and complex options
- WordPress Multiple Navigation bars
- How to separate HTML and WordPress files
- Login to wordpress by clicking a link and specifying usernaname and password in url
- Make PHP work with HTML tags
- Syntax error when I try to insert my loop into an unordered list? [closed]
- How to make modifications only to certain elements of an HTML string on the server-side?
- Function returns text instead of html [closed]
- Printing HTML codes
- How i can get post data from database when i am getting post id from url in wordpress
- How to retrieve the data from the sever and displaying it in a page?
- How to execute html code inside php?
- wp_redirect only works on main site and not on other sites
- wp_insert_post() with HTML tags using PHP
- Where can I find the inline-css of my theme header?
- Make textarea required. Help [closed]
- How to disable all logins except Network login in WordPress Multi site?
- Lost in trying to create user database system
- Remove   from the_excerpt
- Website completely messes up when logging out
- Calling PHP Titles inside Javascript Markup
- How can I use custom menus with a Bootstrap WordPress theme?
- Authentication from sub-folder non-wp cookie WordPress
- Replacing WordPress Icons (menu,icons32, etc)?
- In adding CMS functionality to static website, is complete conversion the only way?
- Make separate text boxes for separate WordPress Custom Fields
- How to Redirect Buddypress Directories To Login Page For Non Logged in Users
- html form: redirect page after form completes submit function and posts data
- HTML Form Question
- WordPress Post Block Element not properly parsed with the_content filter
- Hide A Class and Add Custom HTML Code Using WordPress
- Add other class content with reference class value
- Configure WordPress to Use Responsive Image Rendering
- How to use data URL in WordPress?
- HTML comment cause issue in functions.php script root
- Slug duplicates once clicking on link
- How to find and delete a menu item in php?
- My single.php page skips the first div tag
- Custom woocommerce payment gateway – Form
- opens like sitename.com/URL
- WordPress Slider is not working
- How to display post meta bellow every posts
- Merging Multiple WordPress Websites
- Make a full-width wordpress page
- Display child-page links in sidebar on both Parent Pages AND Child Pages
- Access certain Entry in HTML-Table and pass the entry-data in WP not working [closed]
- Switch position of elements in the footer [closed]
- PHP script to redirect traffic based on website accessed
- Can’t get_users info by using json_encode
- scroll scrpit to particular button position to next id when click button
- Code works on page-example.php by not category-example.php
- Transfer WordPress Login Session to an Extended Webpage on the Same Domain
- WP Admin Bar – Get current theme name as custom menu title
- Add options to WordPress backend
- WordPress HTML Helper
- Migrate php folder to WordPress
- Automatically create a loop for post ID
- Trying to fix multiple category drop down
- get_post_meta is always empty when I use wp_mail
- Trying to post information from a remote database to wordpress page
- Save Option on Database
- Implement “No related posts for this entry” into the loop?
- ACF repeater image in video poster with jquery
- Advanced Custom Fields Show PHP in Text Areas
- Sorting Problem
- Losing Session ID and sessionStorage when navigating to other domains on Multisite
- Custom HTML/CSS Theme into WordPress – SEO considerations
- How to enqueue structured data as file – jsonld file seems not to work
- Slick slider not working on wordpress