If I take the value sanitize_callback out of the argument array
completely, everything works as desired, so error-free.
Yes, and that’s because you used the wrong callable syntax which then causes PHP to use a global function named sanitize_options
instead of the method/function of the same name in your class (i.e. Faqdesk_Settings::sanitize_options()
).
So to solve the problem, in Faqdesk_Settings::initialize_general_options()
, just replace the 'sanitize_options'
with array( $this, 'sanitize_options' )
, like so:
register_setting(
'faqdesk_general_options', //Group Name
'faqdesk_general_options', //Name of the option
array(
'type' => 'array',
'sanitize_callback' => array( $this, 'sanitize_options' ),
)
);
Related Posts:
- Shortcode putting html such as
- How to get bool with `get_option()` when already registered setting with type `boolean`
- Whitelisting items from custom options page
- Prevent invalid or empty values from being saved to the database and retain the form field values upon error
- Saving plugin settings – ERROR: options page not found
- register_setting & add_settings_error validation issues with multiple fields
- How to save Checkbox-Options in Plugin Options Page
- How to get WordPress Time Zone setting?
- How to check if a string is a valid URL
- Limit the number of inactive widgets
- How can I save a multiple select array with the settings API for a plug-in options page?
- Custom plugin: Trying to show saved data on frontend
- What is the best practice for escaping data URIs?
- Remove/unset options field from backend Settings->General?
- Site Title and Tagline in Theme Options Page
- Editor role cannot save custom theme options
- WordPress customizer: load controls in a custom div
- Site Title and Tagline in Pagelines DMS Options Panel
- Enqueue Javascript Correctly for 3.5
- Passing array in add_option()
- How can one utilize a variable as a callback function name for add_settings_field
- Implement a multi-value input field where the number of entries is not limited
- Select dropdown not showing selected value php
- How do I output a database option that is an array into a get_posts array?
- Delete option value from array using update_option()
- Why can’t I use “%s” format value in the WordPress function checked?
- is it possible to force wordpress to always save thumbnails as ‘jpg’ not ‘png’
- Validate Uploaded Image using WordPress’ Built-in Functions?
- How to sanitize my cookie name
- Store and Work with huge array in WP [closed]
- Storing HTML in wp_options
- Why use the Settings API over a new administration menu?
- SQL QUERY – Select a value directly from the database
- Implement toggle switch for theme options in settings API
- Is it necessary to sanitize wp_set_password user input?
- Adding Default Settings to Theme My Login plugin
- How to add values to media “whitelist_options” in wp-admin/options.php template?
- Set the checkbox as checked by default at options page
- Fatal Error relating to sessions.php
- Ajax – Call to undefined function get_option()
- Multiple options not staying selected after saving
- How to remove role=”navigation” from all nav elements?
- Show admin notice on incorrect value on form field
- Options API get_option() and update_option() Not Correctly Updating or Returning
- What esc_ to use to validate this?
- Customizer: Category Select Sanitize
- Setting default category base on theme activation
- Settings API callback function inserts html quotes from nowhere
- Are all hooks/functions tied to Kses meant for sanitization?
- Show the submitted values in the form when validation fails
- Uploading files using the Settings API
- Error: options page not found
- Get URL Parameters from referer
- How to store options in an array
- how to update and display an option without reloading the page
- Security for data obtained from the database
- Settings API validation callback
- Sanitizing text fields in array
- Flush rewrite rules on option update with Settings API
- Pull GetOption() variable into jQuery dynamically created html
- Filtering a Database Query
- Is a series of update_option calls safe, performance wise?
- wp-options keep crashing please help
- WP_OPTIONS table, active_plugins entry [closed]
- Warning: Illegal string offset on theme options page [closed]
- Link blogname and blogdescription to the Options Framework
- retain querystring values when savincustom options in admin
- Get categories names as an array to use it in theme settings
- how to save checkbox data for custom setting?
- How to Change CSS Colors from Custom Plugin Settings Page
- Decimal values via get_option() with custom local (decimal point = comma)
- How to show every second user different types of banners?
- Reading settings in the home page precisely home.php
- Function sanitize_title() does not appear to be working
- Restrict characters in comment section
- WordPress language switcher doesn’t work
- WordPressUser Submission Form
- Get value from db for custom contact form
- Display random image url from list of input values
- Cloning add_settings_field() with jQuery
- Page Options Saving But Not Updating In Backend
- Add a custom WooCommerce settings tab with sections
- WordPress Settings API unable to save settings
- Contact form – problem with displaying message about sent mail
- Contact Form 7 WordPress, checking a few fields, if empty then invalid
- Settings API form – submit with AJAX
- Set all WooCommerce Products to Simple, Virtual & Downloadable
- How to make a pagination with dropdown selection?
- Custom plugin: how do I call a PHP file if settings option is set to true?
- No more get_option(‘date_time’) in WordPress 5.5?
- Trouble matching strings (titles) using wp_query
- register_setting not save checkbox
- How to call a WP Class inside my theme
- Customizer textarea with script tag won’t work in live preview
- image on homepage disappeared due to change of permalink name
- How to update option field in database on clicking the publish button in customizer
- Echo Option Value Based On WordPress User Role
- Custom HTML form using PHP – help with ajax/username validation
- WordPress Setting API – There is no field in options.php
- Use get_option with $emailTo on contact page