register_setting
does not insert anything in the database. It’s supposed to be run in admin_init
, not just on activation, and is for building options pages with the Settings API and handles things like sanitisation and permissions when saving options in the admin.
If you want to add some default option values to the database on activation, use add_option()
. It will add the option and value to the database, but only if there isn’t already a value for that option:
function integrazione_liferay_activate() {
add_option( 'integrazione_liferay_cron_enabled', 1 );
add_option( 'integrazione_liferay_flush_permalinks', 0 );
add_option( 'integrazione_liferay_last_timestamp', 0 );
add_option( 'integrazione_liferay_csv_data', '' );
}
Related Posts:
- Settings API with arrays example
- “Error: Options Page Not Found” on Settings Page Submission for an OOP Plugin
- How to redirect to settings page once the plugin is activated?
- Is get_option function cached?
- What are the advantages to the Settings API?
- Where to store plugin settings fields
- How to output message during plugin activation
- Prevent network activation of plugin
- Inserting Taxonomy Terms During a Plugin Activation?
- What’s the best method for emptying an option created with the Settings API?
- Which to use to execute code during the saving of a plugin settings page?
- Using wp_cron with custom time interval and the register activation hook
- How to use the settings API to set multidimensional arrays
- Call activation hook multiple times
- Add Admin Menu Inside Construct or Init
- Why won’t register_setting() create a setting?
- Settings API – Undefined Index when unchecking checkbox
- Only allow plugin to be activated on root site of multisite
- Disable $title in Plugin Options Screen?
- WordPress Settings API: saving multiple rows of similar data
- why creating tables using $wpdb is not being executed while installing plugins?
- Override pluggable functions in a plugin?
- Does settings API create settings on run time?
- Performance of several get_option() calls
- Extend plugin options page
- Can I use the different settings sections over different pages using the save options group?
- Generating User(s) with Settings API
- plugin development: storing language specific options
- How to add a secondary button to a settings page with a custom action?
- Tabbed navigation for plugin options using same row in database for all?
- Using the Settings API, how should I add multiple values to an option?
- How to add settings subpage from a plugin to a settings page created in theme?
- Remove Internal Style Sheet if no Value Provided?
- WordPress setting with select – where is my mistake?
- null callback in add_settings_section
- Single sanitization callback for multiple fields
- Callback is not called in add_settings_field() when passed as part of an array, but recognises that it’s there. It’s passed Class to Class using OOP
- Custom delete option button in plugin settings
- When to use add_settings_section vs just register_setting?
- Adding settings link to plugin doesn’t work
- Insert terms for custom taxonomy on plugin activation, or each page load (init hook)
- How to fix Uninitialized string offset: error on a checkbox in WP Settings API
- Plugin development: can’t update settings with multiple settings sections
- Updating Woocommerce Settings API when WordPress Settings API saved and vise versa
- Settings API with arrays example
- Prevent invalid or empty values from being saved to the database and retain the form field values upon error
- Allow users to add / remove settings in plugin
- Update problem with update_option() in combination with register_setting()
- Add Link Category on Activation?
- WordPress Plugin Activate / Deactive Failing
- Default settings aren’t used
- WordPress theme options Menu
- Category select options for plugin settings
- Issue on Checkbox with Custom Option Page
- Multiple array for post_content on plugin activation
- Class cannot be found, but it’s available in the file, I get: Fatal Error: Uncaught Error: Class ‘Blocks\Base\Activation’ not found
- Settings API: Setting default option via ‘get_option’ fails
- settings api – add_settings_section not working
- custom wp_editor does not save the content in plugin settings
- Multiple page plugin settings
- Plugin settings are saving but the fields
- Plugin can’t be activated [closed]
- Clean way to initialize plugin in newly-added site when plugin has been network activated?
- Activate / Deactivate plugin
- Update plugin settings option_name for big plugin update
- Pause plugin option page until all data manipulation is complete
- It is possible to pass $args that sent by add_settings_field() inside another function?
- Settings API not saving
- Sanitization and validation input fields – Settings API
- WordPress Fatal error: Uncaught Error: Call to undefined function dbDelta()
- Hide / show settings field based on other field’s value
- Custom Plugin activation error in Multisite
- Plugin setting page – update_option problem
- How Can I Update wp_enqueue_scripts () From WordPress Option Page Radio Buttons
- How to store in the database directly the translation?
- add_settings_error on validating plugin options API
- add_option_{$option} action hook not being called
- Unable to show a message after plugin activation
- How to Modify My Plugin’s Admin Settings so that the Plugin can be Added to a Specific Page?
- Plugin options page: grouping checkboxes
- From my Plugin Settings Page use check boxes to load specific css files (e.g. Bootstrap / Foundation)
- When using an options array the Settings API isn’t creating the database record
- Refresh or redirect page after activate my plugin
- I can install my plugin in localhost but not in my server
- Generate activation url
- Settings API with arrays example
- WordPress plugin tables become corrupt
- Add_menu_page and saving settings
- Updating Style From WP Options Setting Page
- Options don’t save, validation callback not executed
- Deactivate plugin on registration
- How to delete all the options in an option group
- WordPress Plugin default option
- how can a plugin return an error message on activation?
- Update custom settings field in plugin
- Settings API not Saving to Database or Display
- Admin Message after Plugin Option Updated
- Is there a canonical way for a plugin to install a mu-plugin or drop-in?
- How to use register_setting()
- My activator class isn’t running the code inside