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 call a value from the datase using ajax
- Search bar for wp menu
- Adding HTML Code to Replace Text in PHP
- Hide A Class and Add Custom HTML Code Using WordPress
- Fatal error login WordPress [duplicate]
- Executing php on button press
- Add other class content with reference class value
- Shortcode in Shortcode/HTML Graphics and Pictures
- PHP function for horizontal Woocommerce thumbnails and badges
- What are the advantages/disadvantages of ways to use php template files?
- Using Google Analytics in an enqueued JS file
- I can’t go to the page archive-{post_type}.php
- Configure WordPress to Use Responsive Image Rendering
- How to use data URL in WordPress?
- HTML comment cause issue in functions.php script root
- dynamic php menu with hidden sub-categories only showing when the category name is clicked
- Slug duplicates once clicking on link
- couldnt show short code atts in category
- Add Link to PHP message
- separate list of programs in html/javascript coming from php
- Remove span tags from WooCommerce Downloads page
- Help me I cannot link my font-awesome to my WordPress Theme. I have my font-awesome folder already in my project
- Drop down question
- How to enable HTML tags in category description without breaking the category page
- How to use wp_ajax_set_post_thumbnail?
- WP Website is shown in HTML
- Passing a value from an input field to a php function in WordPress?
- How do I disable cache for a certain page?
- Use Search Term in html link and redirect
- Can’t display anything through homepage text editor
- Mysterious letters appearing at the top of a few pages
- Comparison operator != not working in field [closed]
- Current WordPress Page Title as Search Parameter into A Tag
- How to find and delete a menu item in php?
- If user has clicked link add class and store using PHP/WordPress
- How can I edit the final HTML structure of the whole web page
- My single.php page skips the first div tag
- Internal Server Errors – Moving working multi-site install to my localhost
- Install functionality for push notifications but WP-Theme has oddly-named, hidden source files [closed]
- Custom woocommerce payment gateway – Form
- How to add WordPress Featured image in tag ..?
- opens like sitename.com/URL
- AJAX and custom pages
- WordPress Slider is not working
- Problem with my Login Plugin
- How to return html as a string from php for WordPress
- How to display post meta bellow every posts
- HTML Formatting “single_term_title()”?
- how to add functions to my function.php using a child theme?
- How to Protect a private folder inside uploads folder, if User is not Logged In?
- Merging Multiple WordPress Websites
- Show subcategory name selected in specific category woocoommerce
- Make a full-width wordpress page
- How to center all text body in single.php at once?
- How can I create a shortcode from an html and php code written together
- Annoying/confusing WordPress memory limit exhausted
- Display child-page links in sidebar on both Parent Pages AND Child Pages
- sessionStorage saves input value in browser but it is not loaded in the form field
- Collapsible menu on post sidebar only expands and does not collapse
- Unable to insert current username into custom table through html form
- Create form which redirects to site in network?
- Redirect user role to a specific page on login in a multisite network?
- Multiple WordPress sites with different theme and plugin sharing the same content
- How can I get my pagination loop to display the correct number of total pages?
- Woocommerce custom attributes list help
- WooCommerce multiple custom fields code
- How to override html codes in wordpress?
- Access certain Entry in HTML-Table and pass the entry-data in WP not working [closed]
- Remove node from multisites?
- AMP version of e-commerce without plugin
- Allowing HTML elements in title widgets spacing problem
- Target a specific container to style on WordPress storefront theme
- Switch position of elements in the footer [closed]
- Add Text Area To Child Theme’s Home Page
- How to include different html tags in the header for different pages?
- Use PHP to inject HTML into before page renders?
- PHP script to redirect traffic based on website accessed
- Create html tree sitemap
- wordpress form action page not found
- Add .php to end of all WordPress Pages (multisite)
- How to make a parent page for author.php?
- Creating Log-In Page for backend server
- Can’t get_users info by using json_encode
- user update profile for custom code
- scroll scrpit to particular button position to next id when click button
- Vertical Menu for one page only
- Bootstrap Carousel Indicators Won’t Cycle On Custom WordPress Theme
- Multisite – Display different header content based on which site is accessed
- Splitting table data to pages with numbers
- Show post/page into div using function
- List all blogs apart from the current blog and main blog in WordPress Multisite
- wordpress, Category ID
- Adding users to another blog
- Pass form attributes to another php template in wordpress
- Custom HTML form using PHP – help with ajax/username validation
- Code works on page-example.php by not category-example.php
- html to posts, jpg to featured image, zip file contains jpg and html
- how to remove replicating a tag inside loop?
- How to create a php page to collect information from a html page