When should I use register_setting() and add_settings_field()

It seems logic to think that it’s enough to use add_settings_field() Yes, it seems so, but it’s really not enough: register_setting() whitelists the database option for a specific setting which then allows the option to be saved and updated automatically on the wp-admin/options.php page. Note that by “option”, I’m referring to the second parameter for … Read more

How to create a WordPress options page

The first thing that jumps out at me is your use of register_setting(): register_setting( ‘bang-options-group’, ‘joinform_api_url’ ); It is missing a critical, third argument: the sanitization callback. While this parameter programmatically is optional, without it, you cannot validate/sanitize/whitelist the data values passed to the DB via your settings form. Looking further at your code, you … Read more

Customize format of settings

At the moment, this is not possible. Just create your own custom settings page and place your options to it. More details and examples: https://blog.templatetoaster.com/wordpress-settings-api-creating-theme-options/

Settings Page – Option won’t save in database

The problem is that you’re not passing the correct database option name: register_setting( ‘wcs_settings_page’, // option group ‘front-page-slogan’, // database option name ); So looking at the get_option() call and the HTML input name in your front_page_slogan_callback(), the correct option name is wcs_settings: register_setting( ‘wcs_settings_page’, // option group ‘wcs_settings’, // database option name ); Check … Read more

Displaying errors with settings api

No, you need to add a call to settings_errors /** * Displays all messages registered to ‘your-settings-error-slug’ */ function your_admin_notices_action() { settings_errors( ‘your-settings-error-slug’ ); } add_action( ‘admin_notices’, ‘your_admin_notices_action’ ); Else the errors you added will not be displayed. You may also want to check that error_found is true. It is not a wordpress constant I … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)