In the code below, the privacy_policy.html file has several special characters, including some apostrophes. The function below works fine, however, the contents of the privacy_policy.html file are truncated at the first occurance of the apostrophe.
I'm trying the mysql_escape_string (have also tried "real") to no avail...
$my_privacy_policy = file_get_contents(ABSPATH.'/wp-content/plugins/myplugin/privacy_policy.html');
$my_post3['post_content'] = mysql_escape_string($my_privacy_policy);
mysql_escape_string
is deprecated - I would recommend looking at another function to accomplish what you're trying to do. That alone may fix your problem.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.