如何告诉Wordpress使用WP Rest API发布了自定义帖子类型

时间:2018-12-13 02:32:59

标签: angular wordpress ionic3 wordpress-rest-api

我正在使用WP REST API来构建使用该API发布的应用。 一切正常,该帖子显示在网站上,但是每次发布新帖子时,我都使用插件来获取电子邮件。 如果我在wordpress中创建帖子,则会收到电子邮件,但是如果使用WP API发布,则不会触发通知。

这是我的代码:

postQuote(title, category, description){
let data = {
  title: title,
  content: description,
  category: category,
 status: 'publish' 
};
let headers = new HttpHeaders({
  'Content-Type': 'application/json',
  'Authorization': `Bearer ${this.token}`,

});
return this.http.post(this.API_URL + 'issues', data, {headers: headers});
}

我收到的回复是:

{id: 241, date: "2018-12-12T19:26:39", date_gmt: "2018-12-13T02:26:39", 
guid: {…}, modified: "2018-12-12T19:26:39", …}
comment_status: "open"
content: {raw: "testing", rendered: "<p>testing</p>↵", protected: false, block_version: 0}
date: "2018-12-12T19:26:39"
date_gmt: "2018-12-13T02:26:39"
featured_image: false
featured_media: 0
generated_slug: "test-6"
guid: {rendered: "https://XXXXX.com/issues/test-6/", raw: "https://XXXXX.com/issues/test-6/"}
id: 241
category: [9]
status: [4]
link: "https://XXXXX.com/issues/test-6/"
modified: "2018-12-12T19:26:39"
modified_gmt: "2018-12-13T02:26:39"
password: ""
permalink_template: "https://XXXXX.com/issues/%pagename%/"
ping_status: "closed"
slug: "test-6"
status: "publish"
template: ""
title: {raw: "test", rendered: "test"}
type: "issues"
_links: {self: Array(1), collection: Array(1), about: Array(1), 
replies: Array(1), wp:attachment: Array(1), …}
__proto__: Object

谢谢

0 个答案:

没有答案