Filter string like a slug

You can use sanitize_title() function: $string = “This is title string”; // return “this-is-title-string” $slug = sanitize_title( $string ); You can also filter the result of sanitize_title() function using sanitize_title filter: add_filter( ‘sanitize_title’ , ‘sanitize_filter_callback’, 10, 3 ); function sanitize_filter_callback( $title, $raw_title, $context ) { // do something }

How to save html and text in the database?

Just use the wpdb insert and update API, no escaping or sanitizing needed as per the doc, just the raw data. Data: (array) Data to replace (in column => value pairs). Both $data columns and $data values should be “raw” (neither should be SQL escaped). Something like: $wpdb->insert( $wpdb->prefix . “myTable”, array( “doiBody” => $_POST[‘doi-body’] … Read more

where to apply “apply filters” and other Sanitization Functions

I use these commands at the top of my functions.php in all child themes; it will sanitize all POST/GETs. Maybe there are better ways (and it might be redundant), but it appears to work for me. $_POST = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING); $_GET = filter_input_array(INPUT_GET, FILTER_SANITIZE_STRING); But I am open to constructive criticism….

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