Allow HTML in Settings API input field

When you register a setting, you pass the santize callback for that setting: register_setting( ‘my_setting_group’, ‘my_setting_name’, // The next parameter is the validation callback ‘my_setting_validation’ ); Then, in the validation callback you can allow whatever you want. For example, in the next code snippet, users with unfiltered_html capability will be allowed to insert raw HTML … Read more

input on custom settings page adds http://

The escaping function is adding it, esc_url guarantees that what it returns will be a URL, as it’s an escaping function, and so it should, if you’re outputting a URL you should use esc_url so that it’s safe and definitely a URL and not something else maliciously snuck in. The confusion here though, is that … Read more

Why aren’t these WordPress options being saved to the database correctly?

The options are not being saved correctly because you used the wrong input name — it should match the second parameter for register_setting(). So for example, with register_setting(‘myplugin_options_group’, ‘api_username’), the input name should be api_username, but then you used myplugin_api_username. Additionally, it should be noted that screen_icon() has long been deprecated.

hide wp-content from urls

You don’t need a separate rule in your .htaccess. Add … define( ‘WP_CONTENT_DIR’, ‘YOUR_LOCAL_PATH’ ); define( ‘WP_CONTENT_URL’, ‘YOUR_PUBLIC_PATH’ ); … to your wp-config.php. Do not write into wp-settings.php. This file will be overwritten during the next update – never touch a core file.

Settings API settings section not appearing

The settings API can be puzzling 😉 Replace: do_settings_sections( ‘ia_section_id’ ); with do_settings_sections( ‘srchild’ ); to display your defined settings section. The general usage is: do_settings_sections( $page ); where: $page (string) (required) The slug name of the page whose settings sections you want to output. This should match the page name used in add_settings_section(). Default: … Read more

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