最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Create post using rest api with html content

programmeradmin2浏览0评论

I'm trying to create a wordpress post with html code in content for images but I have a problem. For example my content looks like:

<p><img src=";amp;v=4" style="width: 52px;"><br></p>

But in Wordpress editor this same code is with slashes so it doesn't display.

<p><img src=\";v=4\" style=\"width: 52px;\"><br></p>

Api call:

  $api_response = wp_remote_post( '', array(
  'headers' => array(
    'Authorization' => 'Basic ' . base64_encode( 'admin:xxxx' )
  ),
  'body' => array(
    'title'   => $title,
    'content' => $text,
    'status' => 'publish',
    'format'   => 'standard'
  )
) );

Is there any fix for this problem?

发布评论

评论列表(0)

  1. 暂无评论