New answers tagged


You can use wpdb insert function. It's better in every way. It can care about data's escapeing itself and it's shorter. You can use your own query anyway but I would recommended this article for reading


I would suggest the filter_var() function in php It has some predefined filters thats you can use. So to sanitize for a number: $sanitizedCheckbox = filter_var($yourVar, FILTER_SANITIZE_NUMBER_INT); For a string you would just change "_NUM_INT" to "_STRING".


Add a setting, specifying the sanitize_callback: $wp_customize->add_setting( 'my_input', array( 'default' => '100.00', 'sanitize_callback' => 'sanitize_float', ) ); Add the control: $wp_customize->add_control( 'my_input', array( 'label' => 'Please enter a number:', 'section' => ...

Top 50 recent answers are included