I'm using the following code to insert records for my plugin into the db- i need the tag as some posts need special css

$insert_array = array(
                                          'title'=>$_POST['title'],
                                          'file_size'=>$theFileSize,
                                          'path'=>$upload_dir_alt."/". basename( $_FILES['uploadedfile']['name']),
                                          'created_at'=>date( 'Y-m-d H:i:s'),
                                         );
                     $wpdb->show_errors();
                    $result = $wpdb->insert($this->table_name,  $insert_array  );

is there anythhing i can use to encode the html chars? or scape the tag only?

link|improve this question
feedback

1 Answer

Though I recommend against putting HTML markup within titles, if it can't be avoided, you can try the following:

use esc_attr() on the title before putting it into the data base. And when parsing the title out of the database use html_entity_decode()

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.