mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 01:56:46 +00:00
feat(Wordpress Node): Add date fields (#17755)
Co-authored-by: Shireen Missi <shireen@n8n.io>
This commit is contained in:
@@ -134,6 +134,13 @@ export const postFields: INodeProperties[] = [
|
||||
default: 'draft',
|
||||
description: 'A named status for the post',
|
||||
},
|
||||
{
|
||||
displayName: 'Date',
|
||||
name: 'date',
|
||||
type: 'dateTime',
|
||||
default: '',
|
||||
description: "The date the post was published, in the site's timezone",
|
||||
},
|
||||
{
|
||||
displayName: 'Comment Status',
|
||||
name: 'commentStatus',
|
||||
@@ -413,6 +420,13 @@ export const postFields: INodeProperties[] = [
|
||||
default: 'draft',
|
||||
description: 'A named status for the post',
|
||||
},
|
||||
{
|
||||
displayName: 'Date',
|
||||
name: 'date',
|
||||
type: 'dateTime',
|
||||
default: '',
|
||||
description: "The date the post was published, in the site's timezone",
|
||||
},
|
||||
{
|
||||
displayName: 'Comment Status',
|
||||
name: 'commentStatus',
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
export interface IPost {
|
||||
date?: string;
|
||||
author?: number;
|
||||
id?: number;
|
||||
title?: string;
|
||||
|
||||
@@ -187,6 +187,9 @@ export class Wordpress implements INodeType {
|
||||
if (additionalFields.format) {
|
||||
body.format = additionalFields.format as string;
|
||||
}
|
||||
if (additionalFields.date) {
|
||||
body.date = additionalFields.date as string;
|
||||
}
|
||||
responseData = await wordpressApiRequest.call(this, 'POST', '/posts', body);
|
||||
}
|
||||
//https://developer.wordpress.org/rest-api/reference/posts/#update-a-post
|
||||
@@ -239,6 +242,9 @@ export class Wordpress implements INodeType {
|
||||
if (updateFields.format) {
|
||||
body.format = updateFields.format as string;
|
||||
}
|
||||
if (updateFields.date) {
|
||||
body.date = updateFields.date as string;
|
||||
}
|
||||
responseData = await wordpressApiRequest.call(this, 'POST', `/posts/${postId}`, body);
|
||||
}
|
||||
//https://developer.wordpress.org/rest-api/reference/posts/#retrieve-a-post
|
||||
|
||||
@@ -21,6 +21,7 @@ describe('Wordpress > Post Workflows', () => {
|
||||
sticky: true,
|
||||
categories: [1],
|
||||
format: 'standard',
|
||||
date: '2025-03-27T18:30:04',
|
||||
})
|
||||
.reply(200, postCreate);
|
||||
mock
|
||||
@@ -29,6 +30,7 @@ describe('Wordpress > Post Workflows', () => {
|
||||
title: 'New Title',
|
||||
content: 'Some new content',
|
||||
status: 'publish',
|
||||
date: '2025-03-27T18:05:01',
|
||||
})
|
||||
.reply(200, postUpdate);
|
||||
});
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
"typeVersion": 1,
|
||||
"position": [340, 0],
|
||||
"id": "086a9b07-77ee-4c99-9d4e-05fdb63914a4",
|
||||
"name": "updateResponse"
|
||||
"name": "Update Response"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
@@ -24,7 +24,8 @@
|
||||
"updateFields": {
|
||||
"title": "New Title",
|
||||
"content": "Some new content",
|
||||
"status": "publish"
|
||||
"status": "publish",
|
||||
"date": "2025-03-27T18:05:01"
|
||||
}
|
||||
},
|
||||
"type": "n8n-nodes-base.wordpress",
|
||||
@@ -103,14 +104,15 @@
|
||||
"pingStatus": "closed",
|
||||
"format": "standard",
|
||||
"sticky": true,
|
||||
"categories": [1]
|
||||
"categories": [1],
|
||||
"date": "2025-03-27T18:30:04"
|
||||
}
|
||||
},
|
||||
"type": "n8n-nodes-base.wordpress",
|
||||
"typeVersion": 1,
|
||||
"position": [120, 400],
|
||||
"id": "3a022ad5-8ce7-4ff2-988f-a449c7f1466e",
|
||||
"name": "Post Create",
|
||||
"name": "Post > Create",
|
||||
"credentials": {
|
||||
"wordpressApi": {
|
||||
"id": "vNOAnwp9mSIq39cD",
|
||||
@@ -128,7 +130,7 @@
|
||||
}
|
||||
],
|
||||
"pinData": {
|
||||
"updateResponse": [
|
||||
"Update Response": [
|
||||
{
|
||||
"json": {
|
||||
"id": 1,
|
||||
@@ -711,7 +713,7 @@
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "Post Create",
|
||||
"node": "Post > Create",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
@@ -722,7 +724,7 @@
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "updateResponse",
|
||||
"node": "Update Response",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
@@ -751,7 +753,7 @@
|
||||
]
|
||||
]
|
||||
},
|
||||
"Post Create": {
|
||||
"Post > Create": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user