wp_get_attachment_image_src()
function returns an array that’s why your code isn’t working. Try the following code.
<a href="https://wordpress.stackexchange.com/questions/295180/<?php echo esc_url( home_url("https://wordpress.stackexchange.com/" ) ); ?>" rel="home">
<?php
if ( get_theme_mod( 'bwpy_logo2' ) ) :
$img_data = wp_get_attachment_image_src( absint( get_theme_mod( 'bwpy_logo2' ) ) );
$img_url = isset( $img_data[0] ) ? $img_data[0] : '';
// Or you can try this
// $img_url = wp_get_attachment_image_url( absint( get_theme_mod( 'bwpy_logo2' ) ) );
?>
<img src="<?php echo esc_url( $img_url ); ?>" alt="<?php echo get_bloginfo('name'); ?>" class="header-avatar">
<?php else : ?>
<img src="default-site-icon.png" alt="<?php echo get_bloginfo('name'); ?>" class="header-avatar">
<?php endif; ?>
</a>
Related Posts:
- Multisite on Windows with wildcard subdomains
- Are nested subdomains possible with a subdomain multisite?
- Can a multisite’s blogs be accessible from two different sub-domains?
- WP Multisite development with Mamp Pro and wildcard subdomains, not really working for me
- How to use alias domain for multisite installation?
- SSL wildcard issue for wp multisite subdomains
- What is the best way to load the WP environment in a subdomain of my multisite WordPress install?
- Wildcard subdomain for the same site
- Benefits or Problems for using Sub-Directory vs Sub-Domain install of WP Network
- Create multiple subdomains for multi-site from a database
- WordPress Multisite. Can domain be used instead of subdomain?
- Multisite: differences between subdomain and subdirectory mode? Can it be switch after installation?
- How to set up WordPress Multisite on multiple domains without plugin?
- NGinx + WordPress Subdomain Multi with core in Subdirectory
- Set subdomains live in a next step
- Transfer Subdomain site to Multisite setup
- Multisite installation combining subdomains and subdirectories
- How does wordpress multisite manage subdomains?
- Why can’t a WordPress network (multisite) in it’s own folder use subdomains?
- Multisite wordpress and subdomain URL collisions
- “Preview Changes” button doesn’t show changes for previously published posts/pages
- Subdomain multisite gives 404 on sub sites
- Add New Sub Site from the WordPress back end then in sub site options table option_value must be with https
- Broken image multisite
- Testing Multisites with vagrant or Can I use multisite with only an IP address (without domain name)
- Changing Multisite URL after the subsite has been in use
- How do I use different domain for subdomains in WP Multisite?
- Non-wordpress subdomains on Multisite Installation
- Images uploading to wrong directory after changing to multisite
- Sub-subdomain getting redirected to main domain
- Possible to create a multisite network where the main site is non-WP?
- On WordPress Network(multisite), Sub Blogs in Subdirectories or Subdomains? What’s better?
- How do I maintain static directories on multisite subdomains?
- Why are images not displaying?
- Multisite Subdomain Using More Resources Than Others?
- Changing admin sub-domain in WordPress multisite
- Why are images uploaded to main domain, when using multisite with different domains?
- Subdomain login problems
- Change multi-site installation from sub-domains to sub-directories
- How can I have multiple URLs pointing to single WordPress installation?
- Not able to access dashboard of subdomain
- Media library not loading after switching the main site of multisite
- How to stop unlink images when remove a site or user
- Multisite media library uploads broken images
- Wordrpess Subdomains (Multi-Site) without Wildcard
- How to Redirect login User with Mapped Domiain Primary blog Url to Original Sub-site Url
- Can I use two different domain names with a WordPress multisite network?
- WP MU – Accessing ‘Domain-Mapped’ WP-Admin with a subdomain
- Multisite setup on IIS with subdomains
- Icon font not working on subdomains of multisite
- WP Multisite – domain mapping to domain.com and separate site to domain.com/help
- Login on Multiple Sub-Domains without Multisite
- Prevent images on self-hosted WordPress from being served from WordPress.com
- How to run a subdirectory multisite install under a subdomain
- Child Site doesn’t appear in the Network menu
- Multisite Pull Recent Image Attachments from Blog ID
- WordPress Multisite/Network – How to use a subdomain as main blog and subdomain for child sites
- Upload images from one site to another in Multisite
- WPMU Development Environment
- turn single domain off
- Images don’t show up
- Redirect subdomain in Multisite installation?
- Changing path for media upload folder in wordpress multisite
- problem with main site (root domain) redirects to subdomain (multisite)
- Enable wildcard in a WordPress Multisite (Sub-Domains)
- Multiple wordpress installations that shares WordPress & Theme but with separated database
- How to redirect one page on the subdomain
- WordPress Multisite Wildcard Subdomains on Plesk
- Making 2 WordPress sites mutually searchable and more
- Multisite WordPress Configurtion
- Using both subdirectory and subdomains in Multisite
- WordPress Multisite subdomains and sharing the same upload folder
- WordPress MU with subdomain
- Multisite, different domains, optional subdirectory, and htaccess
- Subdirectory and domain multisite installation
- How to configure CNAMES to be part of a WordPress Network
- Configuring Multisite with subdomains
- Multisite: Run a subdomain install from a directory install
- Subdomain Wp-Admin Not Found
- Crop image sizes directly from Media Library across network (not attached to post or page but sidebar)
- ACF Image Object Sizes Issue on Multisite
- How do I remove ‘www.’ from all internal links in self-hosted multisite?
- Pointing multiple subdomains at the same WordPress Installation
- Some Subdomains on a Multisite Install Not Found
- Is it possible to put a site other than #1 as a Multisite top-level domain?
- Images on WP Network’s subsite appear only if accessed via main site’s url
- Not being allowed to use some terms in Add New Site in WordPress
- All links to images are broken in a subdomain multi site environment
- Multi site root site installed on subdomain, with child sites as subdirectories
- Integrating WordPress for blog and other content pages in a web app
- Cookies in Multisite network where sites have their own domain name?
- Make multisite non-existing subdomains go to homepage instead of Index of/ page
- Multisite subdomain site on secondary domain
- Multisite subdomain microsite on secondary domain
- wordpress multisite with already existing subdomain
- How do I test my WordPress subdomains on AWS during migration?
- WordPress multisite with subdomains behind nginx reverse proxy using subdirectories
- WordPress: How to change name of ADD-ON domain’s folder and also change/rename all references to it
- Problem with subdomain with multisite
- Weird Issue – WordPress Multisite – Cannot Access subdomain’s pages