VIP Wordpress REST API - Auotcreate Post和Page

时间:2017-05-15 20:19:19

标签: wordpress rest api

我想编写一个程序,通过VIP Wordpress中的rest api创建批量发布和批量页面。

根据VIP Wordpress Developer Documentation,它声明支持wordpress rest api。

Wordpress Documentation允许我们通过rest api创建帖子和页面。

我无法访问VIP wordpress,但有没有人尝试使用REST API在wordpress中自动创建帖子或页面?

这有什么问题吗?

1 个答案:

答案 0 :(得分:1)

if you want to create post page by Rest API in wordpress you have to get authorization which is basically cookies auth , basic auth and oauth.

in bellow i have done by basic auth

 <?php 
$headers = array (
//  'Authorization' => 'Basic ' . base64_encode( 'username:password' ),
// );

// $response = wp_remote_request( 'url', array(
//  'method' => 'method',
//  'headers' => $headers
// ));
?>

i hope it will be little help for you mate