WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

For some reason when i try to put like a embeded video my video has slashes inside the code, but if I add it in the template itself then the code is fine i was told its "escaping quotes" anyhow this is what i have.

Functions file

    add_action ( 'edit_category_form_fields', 'extra_category_fields');
    function extra_category_fields( $tag ) {    //check for existing featured ID
        $t_id = $tag->term_id;
        $cat_meta = get_option( "category_$t_id");

            <textarea name="Cat_meta[extra4]" id="Cat_meta[extra4]" style="width:60%;"><?php echo $cat_meta['extra4'] ? $cat_meta['extra4'] : ''; ?></textarea><br />
            <span class="description"><?php _e('Video'); ?></span>

add_action ( 'edited_category', 'save_extra_category_fileds');
function save_extra_category_fileds( $term_id ) {
    if ( isset( $_POST['Cat_meta'] ) ) {
        $t_id = $term_id;
        $cat_meta = get_option( "category_$t_id");
        $cat_keys = array_keys($_POST['Cat_meta']);
            foreach ($cat_keys as $key){
            if (isset($_POST['Cat_meta'][$key])){
                $cat_meta[$key] = $_POST['Cat_meta'][$key];
        update_option( "category_$t_id", $cat_meta );

Template file

if (isset($cat_data['extra4'])){
echo $cat_data['extra4'];

I can also post the embed code for the video im trying to post if that helps its pretty long though

Any help is greatly appreciated.

share|improve this question
TIP: Drop the center tag, it's been deprecated for a long time now, use <div style="margin: 0 auto"></div> or <div style="text-align:center"></div>..or a CSS controlled equivalent.. (which you use depends on what you're trying to center).. – t31os Apr 3 '11 at 22:27

WordPress emulates magic_quotes_gpc and won't be deprecating this for some time due to concerns over plugin security and backward compatibility.

To work around this, you need to use stripslashes() or, if you need to strip slashes when data arrives via $_POST, $_GET, $_COOKIE, and $_REQUEST arrays, you can use the WordPress stripslashes_deep() function: http://codex.wordpress.org/Function_Reference/stripslashes_deep

share|improve this answer

If I remember right WordPress emulates magic quotes in any case and disregards server setting for them. But this is trivia. :)

Practical part is to try stripslashes() on your value if you are getting it from form.

share|improve this answer

I don't think WP handles magic quotes internally. I always use this code to check the magic quote:

$value = get_magic_quotes_gpc() ? $value : stripslashes($value);
share|improve this answer
As per other answers WordPress disregards server setting for this and always adds quotes, so it checking for server setting is useless. – Rarst Jul 2 '11 at 9:52

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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