There's this "Site Icon" option in the customizer, which allows you to set a favicon. I'm creating a theme which already has its own favicon.

How can I check if the favicon is already set in the customizer?


WordPress saves the Favicon as site_icon in the options table holding the attachment post ID. What you could do is something like this:

if( false === get_option( 'site_icon', false ) ) {
    // Show favicon

Where get_option() will hit the default ( we provide as the 2nd parameter ) false IF the site_icon does not exist or one has not been uploaded through the customizer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.