I’m trying to update the post_content:

$something = '<a class="class_name" href="#">';
$my_post = array(
      'ID'           => 1,
      'post_content' => $something,
  wp_update_post( $my_post );

Could anyone tell me why this always strips slashes from the $something?
What can I do to avoid this situation and update it just as it’s in $something?

Read more here: Why wp_update_post strip slashes?


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Wordpress related questions and answers: