Getting error to display radio button value in General Settings page

Apart from the isset issue, pointed by Rarst, there’s an error in the sanitization function. esc_attr seems not to work with radio buttons, using esc_sql does the job. You’re also missing the checked state for the buttons: add_filter( ‘admin_init’, ‘myservice_register_function’ ); function myservice_register_function() { register_setting( ‘general’, ‘my_service’, ‘esc_sql’ ); add_settings_field( ‘my_service’, ‘<label for=”service_need”>’.__(‘Do You need … 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

What is the safe way to print tracking code / pixel code before tag or tag

It sounds like you’re trying to implement a general purpose field for users to enter any kind of tracking code/JS into. This approach gives users the most flexibility but it means that you are trusting them to put whatever JavaScript that they want into the header and footer. By default, users need the administrator or … Read more

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