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
<?php
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>
</td>
</tr>
<?php
}
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
<center>
<?php
if (isset($cat_data['extra4'])){
echo $cat_data['extra4'];
}
?>
</center>
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.
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
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.I don’t think WP handles magic quotes internally. I always use this code to check the magic quote: