Skip to content
Read For Learn
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP

Function has_custom_logo when used in Customizer

You have it around the wrong way has_custom_logo() will return false if there is no logo.
function_exists( 'the_custom_logo' ) however will return true if you are using a version of WordPress that support this function.

So if you seperate your if statement like below it will work.

if( function_exists( 'the_custom_logo' ) ) {
    if(has_custom_logo()) {
        the_custom_logo();
    } else {
        echo "No logo";
    }
}

Related Posts:

  1. How do I handle the “WP_Customize_Cropped_Image_Control” callback?
  2. Exiting Customizer alert
  3. Custom logo manage by customizer and theme options
  4. Where is Customizer related data stored is the database?
  5. How do I implement selective refresh with a customizer setting?
  6. How to create a theme customizer ‘sub’ panel?
  7. Use default value of wp_customizer in theme_mod output?
  8. Repeater field in Customizer
  9. Adjust the Device Preview sizes used in the WP 4.5 Customizer
  10. WP Customizer – Prevent live preview
  11. How to upload multiple images with WP_Customize_Media_Control
  12. Different customizer previewUrls per section
  13. Is there any way to add placeholder for WordPress Customizer text input fields
  14. How WP_Customize_Background_Image_Control is supposed to work?
  15. Custom editable content for front page from Theme Customizer
  16. How to print the value of a custom control in the Customizer?
  17. Add/remove controls dynamically based on other settings in Customizer
  18. Customizer JS API dynamically add sections and controls
  19. Get all registered wp theme customizer sections?
  20. Add custom background to div in home page
  21. Theme customizer – possible to disable Live Preview?
  22. get_theme_mod doesn’t return the theme customizer preview’s new values in after_setup_theme hook
  23. How to mix partial and full page refresh in the same section of the customizer?
  24. Conditional Logic to Check for Site Icon
  25. Theme Customization API options on install
  26. How do I check if user input in a field in the customizer is a number?
  27. How to access the nav_menus panel with the customizer api?
  28. Add a “loading” notice when Customizer is making changes
  29. Make Theme Options Native to Theme Customizer
  30. How do I conditionally enqueue stylesheets or scripts in theme customizer settings?
  31. Internalize get_theme_mod CSS Into Stylesheet?
  32. Customiser `active_callback` not working on control with `postMessage` transport method
  33. Is it possible to conditionally displaying and hiding of customizer controls for each device preview?
  34. How to get control choices from $setting object passed to sanitize_callback
  35. Can I change a control’s transport in Customizer depending on the previewed page?
  36. Passing data from customize-controls.js to the customize-preview.js
  37. Add or remove HTML class with selective refresh?
  38. Get attachment id from WP Customizer
  39. How to output WP_Customize_Cropped_Image_Control setting?
  40. Why does get_theme_mod return blank (or default value) but get_option returns saved value?
  41. How to hook on customizer section expanded/active/opened event?
  42. Get current post ID of customizer preview window
  43. Deactivate sections/panels when the Customizer finishes loading
  44. How do I use add_control to offer a list of all pages in the customiser?
  45. Add button to Customizer
  46. Visible Edit Shortcut for WordPress menu that uses nav walker
  47. How to add theme customizer control to specific page?
  48. Customizer active callback live toggle controls
  49. Why is remove_setting and remove_control not working?
  50. Section Name for Menu in Theme Customizer
  51. Is it still possible to nest panels within panels within the customizer?
  52. Get_theme_mod not retrieving value
  53. Need to run a plugin on Customize.php
  54. Customizer preview doesn’t update get_option() value properly
  55. What is the difference between sanitize_text_field() and wp_filter_nohtml_kses()?
  56. Customizer Issue, Default Settings not working
  57. How to move Menus customizer section directly under Site Identity?
  58. WP customizer + gulp + browsersync = refused to display in iframe?
  59. Set Default Page On Customizer Live Preview
  60. Rename and rearrange customizer section
  61. Make Customizer Load Specific Page
  62. Theme Customizer Custom Background / Header Image
  63. get_theme_mod not working
  64. Customizer not saving image settings
  65. How to hide few theme customization options – TwentySeventeen theme
  66. Panel description in Customizer does not show up
  67. Removing http:// from esc url() for wordpress customizer code
  68. Theme Customizer – My panel disappears
  69. Send data from Customizer Settings to Customizer Preview with settingless control
  70. Author functions don’t work in customizer’s selective refresh
  71. How to remove mixed content warnings in WP Customizer
  72. How to extend Customizer payload sent when ‘Save & Publish’ is triggered
  73. Does the customizer support multiple templates?
  74. Using Theme Customizer Built-In Sections
  75. How to use rgba color from theme customizer color picker
  76. Theme Customizer changes are dissappearing when change page
  77. How can a default site icon be set in customizer?
  78. New customizer setting not showing value
  79. Customizer Selective Refresh doesn’t refresh properly with saved value
  80. WP Customizer JS Template not saving color field
  81. WordPress Customizer sanitize_callback: How to Reset to Default on Fail
  82. Removing pre existing menu item
  83. Change “Display Site Title and Tagline” checkbox text in theme customizer
  84. Customizer, change preview url when a control changes
  85. Hide Text when check box option is ticked in customizer?
  86. site identity section name?
  87. WordPress code editor VS customizer “built-in CSS editor”?
  88. How do i remove the ‘WooCommerce’ section from Customizer in Twenty Sixteen Theme?
  89. Customizer options
  90. How to suppress anchor tag click redirection in customizer preview frame?
  91. Customizer Add Section argument ‘active_callback’ => “is_front_page” not working
  92. Theme customization based on grouped pages
  93. Issue with Customizer: only last field shown in section
  94. Is there any function that would allow me to register custom stylesheets for the Customizer itself?
  95. How do i add edit shortcut icon in wordpress without using selective refresh
  96. Hide or remove the Remove button in WP_Customize_Image_Control
  97. get_theme_mod() only working when the customizer is open
  98. Dynamic IDs in WordPress Customizer value bindings
  99. Customizer live preview not working, refreshes but nothing change
  100. What is the name of the setting in the customizer for ‘Display Site Title and Tagline’ checkbox?
Categories theme-customizer Tags logo, theme-customizer
underscores use of the article element on the page template
WordPress archive page showing 404 Error [duplicate]

Recommended Hostings

Cloudways: Realize Your Website's Potential With Flexible & Affordable Hosting. 24/7/365 Support, Managed Security, Automated Backups, and 24/7 Real-time Monitoring.

FastComet: Fast SSD Hosting, Free Migration, Hack-Free Security, 24/7 Super Fast Support, 45 Day Money Back Guarantee.

Recent Added Topics

  • Bug in translation system: load_theme_textdomain() returns true, files are available and accessible but the language defaults to english
  • Custom Elementor controls not appearing in the widget Advanced tab using injection hooks
  • Get the name of the template/*html file used
  • Trying to Add Paging to Single Post Page
  • Sharing media files between live and staging servers
  • How to display the description of a custom post type in the dashboard?
  • Critical error on image display
  • Copying WP data and files into new install?
  • How to determine the DirectAdmin WordPress backup date?
  • How to get list of ALL tables in the database?
© 2026 Read For Learn
  • Database
    • Oracle
    • SQL
  • algorithm
  • asp.net
  • assembly
  • binary
  • c#
  • Git
  • hex
  • HTML
  • iOS
  • language angnostic
  • math
  • matlab
  • Tips & Trick
  • Tools
  • windows
  • C
  • C++
  • Java
  • javascript
  • Python
  • R
  • Java Script
  • jQuery
  • PHP
  • WordPress