Tell me more ×
WordPress Answers is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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?

share|improve this question

closed as not a real question by toscho Jul 16 '12 at 23:33

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, see the FAQ.

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()

share|improve this answer

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