Your checkbox data is saved as 1
or ''
if someone checked or unchecked it.
you can also verify this using var_dump($checkbox)
inside custom_checkbox_field_html
function
This should work.
function custom_checkbox_field_html(){
$checkbox = get_option( 'disabletitle_text' );
$is_checked = ( $checkbox != '' && $checkbox == 1 ) ? 'checked': '';
printf(
'<input type="checkbox" id="disabletitle_text" name="disabletitle_text" value="1" %s/>',
esc_attr( $is_checked )
);
}
Related Posts:
- Custom plugin: how do I call a PHP file if settings option is set to true?
- How can I save a multiple select array with the settings API for a plug-in options page?
- Fatal error: Call to undefined function plugin_dir_path()
- How to Loop Plugin Option Field Set?
- Dynamic URL to reference custom PHP files
- Saving Plugin settings to the database
- Why is PHP Cookie via plugin only set when logged in as Admin and not regular users? and other questions
- Disable External Pingacks on WordPress Posts and Only Allow ‘Self Pings’
- How can one utilize a variable as a callback function name for add_settings_field
- Custom plugin issue when trying to use the shortcode twice on a page [closed]
- Using wp_get_image_editor in a standalone script
- New Plugin Review
- Making Quote Plugin more efficient
- How to access function from outside of a class within this class in WP plugin?
- Create Logout Link WordPress Admin Menu
- PHP can I add line numbers to file_get_contents()
- Why use the Settings API over a new administration menu?
- Adding Default Settings to Theme My Login plugin
- Swapping wp_dropdown_categories function with wp_category_checklist
- How to access global variable $menu inside a class function
- How can I remove a function that has been added to wordpress with add_filter?
- what is the best practice to add new field to an api route
- Retrieve $_POST data submitted from external URL in WordPress(NOT API)
- Whitelisting items from custom options page
- How to call plugin function per site in a multisite?
- WordPress Custom field Colors
- Saving plugin settings – ERROR: options page not found
- How to obtain the current website URL in my theme?
- What exactly do this function declared into functions.php file of a WP theme?
- How to use html inside a functions.php code?
- Plugin Generate Unexpected output during activation
- Using data sent via AJAX in multiple functions on a WP plugin
- Is it possible to define variables in a wordpress shortcode, and then call the shortcode using a specific variable?
- Custom meta box values are not getting saved for my custom post type
- Reading settings in the home page precisely home.php
- Call to undefined function error in plugin
- Execute Jquery when a specific page in my plugin is loading
- Remove submenu item from list
- send popup after wp_redirect()
- Using ACF Relationship field to set post type to draft or published status
- Settings API form – submit with AJAX
- How to change basename url for wp-admin?
- How to Send Pingbacks for all Posts in WordPress?
- Reliable way to add nonce to HTTP Header in WordPress?
- Only the first image uploads
- Add Pre-Defined Value to Click Counter in WordPress
- Illegal string offset checkbox
- ssl redirect function is not working
- How can i avoid duplicate same post in wp?
- Display a custom name when the user has no name settle in his account
- In a foreach loop, how can I add a meta value if it doesn’t exist?
- How to override theme’s public static function inside of a trait?
- register_setting not save checkbox
- Enqueue sripts and styles only if function is called
- post_exists stops working in a scheduled event
- Taxonomy Child Term, Counter is staying on 0
- Add Admin Option w/ Anonymous Function
- add menu page in loop menu order
- PHP get_category() function redeclared
- How to Request a User to Register on Landing at a Site, Then Automatically Delete the Users Password on Logout?
- Private messaging – Getting and displaying the avatar/url of a message recipient
- Permission error on plugin save
- Trouble using wordpress functions in a pop-up modal form
- Issues separating my Plugin pages into different files
- how can I make content from a plugin hidden when user is logged in? [duplicate]
- display php code in header using wp_head()
- How do I change the Go To Categories link in the term_updated_messages
- WP Custom tables query
- Is there a way for a plugin to add an attribute to the tag of a theme?
- wp_set_object_terms and arrays
- My shortcode is showing up twice
- Database “Migration” for Plugins?
- Can’t load WP function into external function
- Image as Sales Badge
- How to Arrange PHP Files to Allow for Multiple Types of Pages?
- Hook called before text widget save
- wpdb prepare insert table doesn’t work
- How to modify the default feed via a function
- How can I hook into the wp_mail function used by BackWPup?
- how to enqueque code in a php file from functions.php
- Convert all uploaded PNG files to PNG-8 format
- Uses for function: wp_update_user
- PHP: $_SESSION destroyed after page reload for my custom session
- Exclude category from function – PHP
- Update user meta when an external link in admin notice is clicked
- Is there an option to execute javascript file only on plugin activation
- Ajax in a class instantiated via shortcode
- Populate Posts based on category selected using AJAX that means without page refresh
- Why transition_post_type hook is called twice for the same post?
- Can’t get_users info by using json_encode
- Submit to itself don’t work
- Page returning ID from array, how to return the correct values for post in acf wordpress
- Removing all my hardcoded URLs with get_site_url()
- Display default WordPress login/registration form into a modal window
- Highlight main menu when on specific posts or pages
- Pull GET parameter from URL in functions.php
- Adding Gravity Form With if(is_page) Is Not Working
- Import js variables loaded via wp_localize_script() into js module without global scope connection
- Custom taxonomy with page post type – WordPress
- Alternative to php echo within code