Stripslashes post meta values before handing off to add_post_meta. Use wpdb::escape instead of addslashes. Props takayukister. fixes #4028
git-svn-id: https://develop.svn.wordpress.org/trunk@5249 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
d8c8ecb711
commit
3a9b0e0c08
@ -35,8 +35,9 @@ class WP_Import {
|
||||
}
|
||||
|
||||
function get_tag( $string, $tag ) {
|
||||
global $wpdb;
|
||||
preg_match("|<$tag.*?>(.*?)</$tag>|is", $string, $return);
|
||||
$return = addslashes( trim( $return[1] ) );
|
||||
$return = $wpdb->escape( trim( $return[1] ) );
|
||||
return $return;
|
||||
}
|
||||
|
||||
@ -336,6 +337,7 @@ class WP_Import {
|
||||
if ( $postmeta) { foreach ($postmeta as $p) {
|
||||
$key = $this->get_tag( $p, 'wp:meta_key' );
|
||||
$value = $this->get_tag( $p, 'wp:meta_value' );
|
||||
$value = stripslashes($value); // add_post_meta() will escape.
|
||||
add_post_meta( $post_id, $key, $value );
|
||||
} }
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user