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?
- How to use alias domain for multisite installation?
- 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
- 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
- Testing Multisites with vagrant or Can I use multisite with only an IP address (without domain name)
- How do I use different domain for subdomains in WP Multisite?
- Non-wordpress subdomains on Multisite Installation
- 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?
- Why are images not displaying?
- Multisite Subdomain Using More Resources Than Others?
- Change multi-site installation from sub-domains to sub-directories
- Media library not loading after switching the main site of multisite
- Multisite media library uploads broken images
- Wordrpess Subdomains (Multi-Site) without Wildcard
- 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
- How to run a subdirectory multisite install under a subdomain
- Upload images from one site to another in Multisite
- problem with main site (root domain) redirects to subdomain (multisite)
- Enable wildcard in a WordPress Multisite (Sub-Domains)
- How to redirect one page on the subdomain
- WordPress Multisite Wildcard Subdomains on Plesk
- Start with multi-site feature now or later?
- WordPress Multisite Question
- ‘Cheatin’ uh?’ Error When Attempting to Upload Images After 3.4 Update
- Create subdomain out of sight the wp multisite
- multisite subdomain behind reverse proxy
- Nginx Wildcard SSL with WordPress Multisite Subdomains
- Is the Multi site functionality a viable option for Country and Language targeting?
- get post id by $content (so by post content)
- Multisite Subdirectory with same domain subdomain
- WordPress Multisite blogs not working after domain swap
- Multisite, Subdomain, shared NFS directory Linux HELP
- Redirect to localhost after installing Multisite on server
- Show media-frame-menu on custom Media Frame
- Login problems on multisite installation with different domains
- One Domain, Two Installs of WordPress
- MU/Subdomains + Domain Mapping + SSL?
- Multisite install w/ Sub domains on a subdomain
- Set up Network Locally on a Flash Drive
- Suspicious mesage appears instead of images
- When creating a multisite, the sub-folders option is not available
- Multisite – getting a 404 for additional site created using subdomain install
- WordPress MU subdomain vhost
- Missing images after moving servers
- WordPress in subdirectory, Multisite using subdomains Nginx
- wp_get_attachment_image_src returns incorrect URL on multisite
- Creating a subdomain network in a subdomain
- How to query blogs posts of WordPress sub domain?
- Programmatically creating site in a network
- Https and Http Login Issue on WordPress Multisite
- Migrate single site to Multisites with plugins, cPanel and already working subdomains
- Should i install multiple wordpress for one site?
- WordPress Multisite with subdomains on different domains
- Can’t create a subdomain network – and WP is installed in webroot, not a folder
- Using Same User Database on Subdomain
- Subdomain is not working
- WordPress Multisite and how to apply sef urls only to specific sites
- multisite installed on subdomain now want another subsite on subdirectory
- Can I run both a wordpress blog plus another service(ex. a Shopify store) on the same domain?
- How to update wordpress content of wordpress multi-site subdomain
- Multisite Subdomain Change
- WordPress Multisite loads wrong subdomain dashboard
- WordPress Multisite with Wildcard Certificates not mapping correctly
- Multisite network subdomains doesn’t work
- How to convert multisite subdomain from http to https
- new WPMS site not working / Q setting up new site/subdomain
- Sub-directory domain on subdomain multisite?
- WordPress Multisite Network Subdomain
- Multisite WordPress Configurtion
- 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
- 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)
- How do I remove ‘www.’ from all internal links in self-hosted multisite?
- Some Subdomains on a Multisite Install Not Found
- 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
- Make multisite non-existing subdomains go to homepage instead of Index of/ page
- Multisite subdomain microsite on secondary domain