The get_theme_mod()
function could return an explicit false
. The ===
operator looks for exact matches, so in the case of hide_logo
not being set the function would return false
and false is not an exact match to an empty string ''
. The ==
operator is a bit more forgiving in that sense which is why you don’t have an issue there.
You could supply a default value as the second parameter which will be returned if a value is not set or does not exist:
if( '' === get_theme_mod( 'hide_logo', '' ) ) {}
Related Posts:
- Custom query to get post names beginning with a digit
- Real time Duplicate title check
- How to check from which page the user is coming to the current page?
- Blank on static home page?
- Adjust the results quantity for Search Results page pagination
- Execute only on a certain page
- Audio tags around Mp3 URL in content
- the_author_meta not working
- Type hinting and void return question
- Configuring WP-CLI on Windows 10
- Assign a picture URL to a page via PHP
- Display user role Name – not slug
- Adding ads code between comments
- Get Custom URL For Custom Taxonomy
- How to add custom post meta to default blog post?
- Shortcode content filter?
- Update grandchild repeater field with value per row
- Paypal form integration with wordpress registration form without plugin [closed]
- Uploading files using the Settings API
- fatal error call to undefined function get_header in index.php on line 1
- Plugins not working on AJAX requests
- Can anyone offer any help with this function?
- JQuery calling a Custom PHP function (Works in Dev but not in WordPress)
- How to remove woocommerce_breadcrumb() from do_action( ‘woocommerce_before_main_content’ ); [closed]
- Hide a div when tags doesnt exist [duplicate]
- Multiple meta_key in one global $wpdb;
- What does -> mean in WordPress?
- Parsing Menu Items and Blog Posts
- How to update and save user metadata on page visits?
- How to optimize update_post_meta?
- Contact Form 7 – Replace database configured form template with a static file
- How to pass argument to add_action while the method is inside a class?
- Add URL parameter to all internal links using a specific theme
- How can I use a text and a function php
- How to make changes to style.php [closed]
- select wordpress custom post type
- Unserialize Custom Field & Save as Multiple Rows in WordPress Database
- Modify WooCommerce used to get all orders in dashboard
- Add a product category to a specific product via a button
- WordPress can’t use ZipArchive
- Adding an Anchor Link to a wordpress menu using WPBakery Page Builder
- WordPress loading progess – wp-blog-header.php
- Trying to generate a CSS file in wordpress uploads folder
- register_setting not save checkbox
- Add Product Permalink in woocommerce admin order page
- Proper use of Output Buffer for a whole php clas
- get_template_part() not working with Advanced Custom Fields plugin
- List all ACF field values across every post on one page
- How do I make comment-reply-button with that takes to comment reply form on click
- Allow user to choose header style
- Require advice handling a URL redirect from a Third Party. URL Params need to populate and then forward to payment
- Not able to add new item in wordpress home page
- views How to load javascript on custom page template?
- Two theme locations for two menus, but only one is showing up
- How to find the function which is outputting Array
- Contact form field in wordpress menu
- How can I include a file related to blog URL? Nothing seems to work
- How Can I Center the Logo in the Navigation Menu? [closed]
- Sort posts by title, sort array by largest number [duplicate]
- Check radio get value to array
- Your PHP installation appears to be missing the MySQL … After deleting and restarting from cpanel
- How to create shortcode of this PHP code
- How to use url and amin-ajax.php
- WP – Ajax call back data printed in the console.log
- Dynamic Email Handler with ‘header (“Location: …’
- Grabbing value of input field inside of array
- Implement OAuth2 in custom plugin
- login redirect based on user role not work as expected
- redirect user from login page if is logged
- How to set variable to specific field when querying
- How to lock users account until approvation
- WooCommerce: write featured image dimensions to custom fields in product’
- How can I change the URL via add_rewrite_rule()
- Variable ++ in query loop
- Generate and upload screenshot as featured image for user-submitted post
- How can precision be improved for the debug log timestamp?
- Pull latest Youtube Video from json url and make new post
- Edit Error Page style
- How to sort wordpress posts by selecting a year from a drop down?
- WooCommerce Checkout Cart [closed]
- How can I get values from a custom post type depending on where I click on my SVG map?
- a problem in class in class-wp-hook.php
- Differences and dis/advanages between: Fast-CGI, CGI, Mod-PHP, SuPHP, PHP-FPM
- Count custom posts type and filter by tag
- Error with PHP 8
- How to create a User Role and give permission to only use Web Stories plugin?
- transition_post_status hook, works – but not if the post is new
- How can I change the location where the custom field is displayed in the Quick Edit tab in WordPress
- AJAX WP_Query’s order and orderby parameters not working
- PHP $_SESSION array – only showing current index
- How can I use AJAX in child theme template?
- WordPress taxonomy and terms question
- How do I a custom search form by taxonomies?
- WordPress REST API – Custom field not added to pages
- Woocommerce – add tracking code to another email template
- How to add custom user role into wordpress
- change title of page dynamically
- Custom Filtering date with newsletter
- WordPress critical error after trying to update to 6.2 – Fatal error: Allowed memory size of 268435456 bytes exhausted
- Custom plugin doesn’t show in admin menu – when code added, displays an empty page