Skip to content

Commit 724b5a5

Browse files
feat(Wordpress Node): Add date fields (#17755)
Co-authored-by: Shireen Missi <[email protected]>
1 parent 164800f commit 724b5a5

File tree

5 files changed

+33
-8
lines changed

5 files changed

+33
-8
lines changed

packages/nodes-base/nodes/Wordpress/PostDescription.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,13 @@ export const postFields: INodeProperties[] = [
134134
default: 'draft',
135135
description: 'A named status for the post',
136136
},
137+
{
138+
displayName: 'Date',
139+
name: 'date',
140+
type: 'dateTime',
141+
default: '',
142+
description: "The date the post was published, in the site's timezone",
143+
},
137144
{
138145
displayName: 'Comment Status',
139146
name: 'commentStatus',
@@ -413,6 +420,13 @@ export const postFields: INodeProperties[] = [
413420
default: 'draft',
414421
description: 'A named status for the post',
415422
},
423+
{
424+
displayName: 'Date',
425+
name: 'date',
426+
type: 'dateTime',
427+
default: '',
428+
description: "The date the post was published, in the site's timezone",
429+
},
416430
{
417431
displayName: 'Comment Status',
418432
name: 'commentStatus',

packages/nodes-base/nodes/Wordpress/PostInterface.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
export interface IPost {
2+
date?: string;
23
author?: number;
34
id?: number;
45
title?: string;

packages/nodes-base/nodes/Wordpress/Wordpress.node.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,9 @@ export class Wordpress implements INodeType {
187187
if (additionalFields.format) {
188188
body.format = additionalFields.format as string;
189189
}
190+
if (additionalFields.date) {
191+
body.date = additionalFields.date as string;
192+
}
190193
responseData = await wordpressApiRequest.call(this, 'POST', '/posts', body);
191194
}
192195
//https://developer.wordpress.org/rest-api/reference/posts/#update-a-post
@@ -239,6 +242,9 @@ export class Wordpress implements INodeType {
239242
if (updateFields.format) {
240243
body.format = updateFields.format as string;
241244
}
245+
if (updateFields.date) {
246+
body.date = updateFields.date as string;
247+
}
242248
responseData = await wordpressApiRequest.call(this, 'POST', `/posts/${postId}`, body);
243249
}
244250
//https://developer.wordpress.org/rest-api/reference/posts/#retrieve-a-post

packages/nodes-base/nodes/Wordpress/__tests__/workflow/post/post.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ describe('Wordpress > Post Workflows', () => {
2121
sticky: true,
2222
categories: [1],
2323
format: 'standard',
24+
date: '2025-03-27T18:30:04',
2425
})
2526
.reply(200, postCreate);
2627
mock
@@ -29,6 +30,7 @@ describe('Wordpress > Post Workflows', () => {
2930
title: 'New Title',
3031
content: 'Some new content',
3132
status: 'publish',
33+
date: '2025-03-27T18:05:01',
3234
})
3335
.reply(200, postUpdate);
3436
});

packages/nodes-base/nodes/Wordpress/__tests__/workflow/post/post.workflow.json

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"typeVersion": 1,
1616
"position": [340, 0],
1717
"id": "086a9b07-77ee-4c99-9d4e-05fdb63914a4",
18-
"name": "updateResponse"
18+
"name": "Update Response"
1919
},
2020
{
2121
"parameters": {
@@ -24,7 +24,8 @@
2424
"updateFields": {
2525
"title": "New Title",
2626
"content": "Some new content",
27-
"status": "publish"
27+
"status": "publish",
28+
"date": "2025-03-27T18:05:01"
2829
}
2930
},
3031
"type": "n8n-nodes-base.wordpress",
@@ -103,14 +104,15 @@
103104
"pingStatus": "closed",
104105
"format": "standard",
105106
"sticky": true,
106-
"categories": [1]
107+
"categories": [1],
108+
"date": "2025-03-27T18:30:04"
107109
}
108110
},
109111
"type": "n8n-nodes-base.wordpress",
110112
"typeVersion": 1,
111113
"position": [120, 400],
112114
"id": "3a022ad5-8ce7-4ff2-988f-a449c7f1466e",
113-
"name": "Post Create",
115+
"name": "Post > Create",
114116
"credentials": {
115117
"wordpressApi": {
116118
"id": "vNOAnwp9mSIq39cD",
@@ -128,7 +130,7 @@
128130
}
129131
],
130132
"pinData": {
131-
"updateResponse": [
133+
"Update Response": [
132134
{
133135
"json": {
134136
"id": 1,
@@ -711,7 +713,7 @@
711713
"index": 0
712714
},
713715
{
714-
"node": "Post Create",
716+
"node": "Post > Create",
715717
"type": "main",
716718
"index": 0
717719
}
@@ -722,7 +724,7 @@
722724
"main": [
723725
[
724726
{
725-
"node": "updateResponse",
727+
"node": "Update Response",
726728
"type": "main",
727729
"index": 0
728730
}
@@ -751,7 +753,7 @@
751753
]
752754
]
753755
},
754-
"Post Create": {
756+
"Post > Create": {
755757
"main": [
756758
[
757759
{

0 commit comments

Comments
 (0)