Make WordPress Core

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#51015 closed defect (bug) (duplicate)

has_custom_logo isn't working with Customizer

Reported by: athemeart's profile athemeart Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Customize Keywords:
Focuses: Cc:

Description

Hi
the has_custom_logo function isn't working perfectly with Customizer edit mod .
i am trying below code, it fine for without Customizer

if ( has_custom_logo() ) {
	echo the_custom_logo();
}else{
	bloginfo( 'name' );
}

Change History (10)

#1 @mukesh27
4 years ago

  • Component changed from General to Customize
  • Focuses javascript administration template performance coding-standards removed

#2 @SergeyBiryukov
4 years ago

  • Keywords reporter-feedback added

Hi there, welcome to WordPress Trac! Thanks for the report.

Could you clarify what exactly is not working, and what the expected result would be?

The steps to reproduce the issue on a clean install or some screenshots would be helpful too.

#3 @athemeart
4 years ago

HI @SergeyBiryukov 

it's my pleasure ,

has_custom_logo can't check empty / switch the if condition to else when activated Customizer. For more clarification, you can check video ( https://streamable.com/73iyqu )

Thanks

#4 @Laxman Prajapati
4 years ago

Hello,

We have checked with WordPress 5.5 latest version installation, If we can select custom logo from customizer the logo is appeared on the front side and it is working fine.

For your issue i have tried to check but we are getting this site can't be reached error on the provided for more info url.

Are you getting any type of error on console or else?

Also could you please try to check with switch another theme?

Thanks,

#5 follow-up: @athemeart
4 years ago

Hello @laxman-prajapati

Would you use like as below ...

if ( has_custom_logo() ) {

  echo the_custom_logo();

}else{

   echo "isn't appearing with customizer ";

}

Thanks

#6 in reply to: ↑ 5 @athemeart
4 years ago

Replying to athemeart:

Hello @laxman-prajapati

Would you use like as below ...

if ( has_custom_logo() ) {
 // it's working fine
  echo the_custom_logo();

}else{
    // here is the issue 
   echo "isn't appearing with customizer ";

}

Thanks

#7 @Laxman Prajapati
4 years ago

Seems working fine for me.

Thanks,
Laxman P.

#8 @sabernhardt
4 years ago

I was able to reproduce with these steps:

  1. Add the has_custom_logo conditional code to the theme template file (likely header.php).
  2. Open Customizer.
  3. Set an image as the logo.
  4. Click Publish and refresh the page.
  5. Then remove the logo image.
  6. Before publishing and refreshing the page, check results.

The blog name should show after removing the logo. However, the_custom_logo still runs and gives the hidden linked image placeholder, even though has_custom_logo should return false. It does seem to work correctly after publishing and refreshing the page.

Note also: the function the_custom_logo does not need echo (echo is already part of it).

#9 @dlh
4 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed
  • Version 5.5 deleted

Duplicate of #43081.

#10 @SergeyBiryukov
4 years ago

  • Keywords reporter-feedback removed
Note: See TracTickets for help on using tickets.