Preserve Backslashes in Post Content
-
There has been an issue with the preservation of backslash characters in post content when duplicating the post, which is due to the wp_insert_post method. wp_insert_post calls sanitize_post_field with a ‘db’ context, which appears to be stripping out the backslash characters.
I found a workaround to this issue, which may or may not be the most ideal. In duplicate_post_admin.php, in the duplicate_post_create_duplicate() method:
Change
'post_content' => $post->post_content,
to use addcslashes() like this
'post_content' => addcslashes($post->post_content, '\\'),
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Preserve Backslashes in Post Content’ is closed to new replies.