You would use a conditional check to determine if the option is selected, before adding your function to the action hook.
Example:
$options = get_option( 'chec_settings' );
if ( $options['chec_checkbox_field_0'] == '1' ) {
add_action ('admin_bar_menu', 'remove_wp_logo', 999 );
}
Related Posts:
- Add multiple custom fields to the general settings page
- bloginfo() vs get_option?
- what is the meaning of settings_fields()
- How do you permanently remove default rewrite rules from the wp_options table?
- Set default options for inserting media
- Theme options WP Editor
- Updating users_can_register option?
- Fatal error when trying to get admin email on contact form
- options.php problem – data not saved
- Hook specific functions if on a specific admin page
- Two Types of settings in WP – The Doubt
- What is the correct way of updating wordpress options
- Move Custom Fields on General Settings Page to New Location
- “options.php” not found
- How do I register a new settings page? [closed]
- Settings in functions.php used by a plugin
- Random text changing to weird icons in both admin & front end
- Register a widget area when a theme option has been saved?
- Remove Actions/Filters added via Anonymous Functions
- Programatically add options to “add new” custom field dropdown
- Excluding iPad from wp_is_mobile
- opening links in new tab using – add_filter( ‘the_content’, ‘make_clickable’);
- How to add classes to images based on their categories?
- Use ‘add_theme_support’ instead of ‘add_custom_image_header’ In WordPress 3.4
- Generating Responsive Background Image Sizes in PHP
- Replacing select2 in admin backend for all selects
- How to hook into the quick edit action?
- Session is not starting
- Override a class function to include a custom template
- How to auto-update child posts whenever the parent post is updated?
- I created a child theme and it doesn’t work for some of the css files
- the_post_thumbnail fallback using hooks
- How to detect first visit of a user?
- Hide WYSIWYG editor on certain templates
- Disable shortlinks like ?p=1234 to prevent scraping
- Redirect a list of URLs to another URL, using functions.php
- Override woocommerce wc-class function
- How to hide, and not to remove the attributes metabox?
- how to edit functions.php in a child theme
- Only display link to author social media when it exists [closed]
- Get current page_id before loop, in functions.php
- Adding Default Settings to Theme My Login plugin
- How to limit character length in BuddyPress function output [closed]
- Using $themename Variables
- Ordering posts by publish date not working?
- Is possible add icon in title posts only in specific tag?
- Wp_schedule_event functions.php
- How to auto refresh when user change postcode
- Add sequential number to a Gravityforms form
- Can’t generate thumbnail images
- error in getting post id
- is_author(get_current_user_id()) returns false when author id and user id match
- Exclude category from shortcode
- unnecessary request call for js and css after calling wp_dequeue_script
- Custom HTML markup
- Functions Error: Impacting Galleries
- How to use author meta in shortcode?
- Get urls of images in a gallery?
- How to cut off question mark in url with functions.php
- Undefined variable error in new function
- How to rewrite wordpress search to work on specific category
- Theme JS is available but theme CSS isn’t
- Genesis Framework: How to exclude a specific author from archive custom loop
- How to Add Shortcode to html img code?
- Passing Jquery value to WordPress function
- How to pass variables from one function to another or combine functions
- How to create a shortcode out of a php function
- Is it possible to use add_filter in an included file in the child theme’s functions.php?
- Insert Content Before div#main from the functions.php File
- Insert function insde body tag
- Unable to add extra elements to the main navi (wp_nav_menu_items)
- Internet Explorer opens links to .msi files as text in a new tab
- call wp_insert_user in custom class doesnt work
- I would like single.php to act just like index.php
- Does WordPress has an automatic link parse function?
- A better way to get stats
- Conditional custom menu?
- What function actually renders the wp_admin_bar ? How can I call it?
- Get URLs for AJAX Filter Checkboxes WordPress
- redirecting a URL if accessed directly
- Detect Ajax call inside pre_get_posts function
- What is wp_get_post_tags for media tags?
- How do I trigger WP CLI DB export using a PHP function?
- WordPress does not load jQuery
- get_current_user_id() always return 0 in if else statement
- Redirect specific author posts to another url
- Show number of sold products but be first for less than 2
- How to retrieve image IDs from shortcode content?
- Class::$template_dir_path=get_template_directory();
- admin-ajax.php & my wp-admin folder url showing in header
- WordPress – Custom Nav menu for logged in users – Shopkeeper theme
- Change post count on tag/terms pages to 10
- How to use if (is_page_template (”))
- Error function main() is a non-object to construct my Ajax.php
- Automatically add custom fields (post_meta) to all published posts, hourly, via wp_cron?
- Gravity Forms After Submission – GFFormsModel::update_lead_field_value?
- Fatal error after changes to functions.php, even with original file
- update_post_meta after form is submited
- Should I use `get_stylesheet_uri()` or `get_template_directory_uri()` when calling my CSS Stylesheet?
- Missing argument 2