Show the submitted values in the form when validation fails

You can’t. If you’re using the settings API correctly, here’s what happens when you try to save your options: Form posts to options.php WordPress handles $_POST and runs update_option on your registered settings Your sanitize callback from register_setting is applied Any data that fails/you don’t return in your callback isn’t saved WordPress redirects back to … Read more

Unable to sanitize in customizer and escape in theme without removing ability for user to use “< br >” to insert a line break

You should use the helping site of validation – https://codex.wordpress.org/Data_Validation I think in your context is wp_kses the right function. You can allow html tags. The function have a lot of possibilities to use it with custom requirements. A small example to fast usage: $allowed_html = array( ‘a’ => array( ‘href’ => array(), ‘title’ => … Read more

Prevent invalid or empty values from being saved to the database and retain the form field values upon error

You’d do it something like this: function sanitize_number_callback ($input){ if( !preg_match( ‘/…regex for valid here…/’, $input ) ){ add_settings_error( ‘my_option’, esc_attr( ‘my_option’ ), //becomes part of id attribute of error message __( ‘Number must be a positive integer’, ‘wordpress’ ), //default text zone ‘error’ ); $input = get_option( ‘my_option’ ); //keep old value } return … Read more

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