skyboy8848 发表于 2017-9-4 22:53:59

wordpress免登陆发布接口问题

用了论坛上下的wordpress免登陆发布接口4.x版的,发布文章都正常,就是有磁力链接这种“magnet:?xt=urn:btih:”字样的,都会被删去,采集数据正常,通过发布接口就没有“magnet:?xt=urn:btih:”字样,怀疑是发布接口中字符转换造成的,求大神解答。
类似字符转换代码:出问题的主要是提交的post_content字段。function hm_strip_slashes($str){
//if (get_magic_quotes_gpc()) return stripslashes($str);
return $str;
}
function hm_strip_slashes_new($string, $force = 0) {
      !defined('MAGIC_QUOTES_GPC') && define('MAGIC_QUOTES_GPC', get_magic_quotes_gpc());
      if(!MAGIC_QUOTES_GPC || $force) {
                if(is_array($string)) {
                        foreach($string as $key => $val) {
                              $string[$key] = daddslashes($val, $force);
                        }
                } else {
                        $string = addslashes($string);
                }
      }
      return $string;
}
function hm_do_save_post($post_detail)
{
    global $post_author,$post_ping,$post_status,$translate_slug,$autoAddCategory,$post_next;
      extract($post_detail);

    $post_title=trim(hm_strip_slashes($post_title));
      $post_name=$post_title;
      if($translate_slug) $post_name=hm_tranlate($post_name);
      $post_name=sanitize_title( $post_name);
      if( strlen($post_name) < 2 ) $post_name="";
   
    $post_content=hm_strip_slashes($post_content);
   
    $tags_input=str_replace("|||",",",$tags_input);
      
      if(isset($post_date) &&$post_date)
{
      $post_date_gmt=$post_date;
      $post_status='publish';
}

leweizxl 发表于 2017-9-5 14:06:42

已经重新发你了
页: [1]
查看完整版本: wordpress免登陆发布接口问题