diff --git a/packages/nodes-base/nodes/Wordpress/Wordpress.node.ts b/packages/nodes-base/nodes/Wordpress/Wordpress.node.ts index b38d41f3e39..24e2bfb1e6d 100644 --- a/packages/nodes-base/nodes/Wordpress/Wordpress.node.ts +++ b/packages/nodes-base/nodes/Wordpress/Wordpress.node.ts @@ -275,6 +275,9 @@ export class Wordpress implements INodeType { if (options.search) { qs.search = options.search as string; } + if (options.before) { + qs.before = options.before as string; + } if (options.after) { qs.after = options.after as string; } @@ -446,6 +449,9 @@ export class Wordpress implements INodeType { if (options.search) { qs.search = options.search as string; } + if (options.before) { + qs.before = options.before as string; + } if (options.after) { qs.after = options.after as string; } diff --git a/packages/nodes-base/nodes/Wordpress/__tests__/workflow/page/page.test.ts b/packages/nodes-base/nodes/Wordpress/__tests__/workflow/page/page.test.ts index d8e1f01d89e..7ef1e65097e 100644 --- a/packages/nodes-base/nodes/Wordpress/__tests__/workflow/page/page.test.ts +++ b/packages/nodes-base/nodes/Wordpress/__tests__/workflow/page/page.test.ts @@ -19,6 +19,10 @@ describe('Wordpress > Page Workflows', () => { .reply(200, pageCreate); mock.get('/wp-json/wp/v2/pages/2').reply(200, pageGet); mock.get('/wp-json/wp/v2/pages').query({ per_page: 1 }).reply(200, pageGetMany); + mock + .get('/wp-json/wp/v2/pages') + .query({ per_page: 1, before: '2026-01-01T00:00:00' }) + .reply(200, pageGetMany); mock .post('/wp-json/wp/v2/pages/2', { id: 2, diff --git a/packages/nodes-base/nodes/Wordpress/__tests__/workflow/page/page.workflow.json b/packages/nodes-base/nodes/Wordpress/__tests__/workflow/page/page.workflow.json index 5c167d2ccba..bab9f0c0d8d 100644 --- a/packages/nodes-base/nodes/Wordpress/__tests__/workflow/page/page.workflow.json +++ b/packages/nodes-base/nodes/Wordpress/__tests__/workflow/page/page.workflow.json @@ -5,8 +5,8 @@ "parameters": {}, "type": "n8n-nodes-base.manualTrigger", "typeVersion": 1, - "position": [0, 300], - "id": "5a1fb2b5-9262-4511-9247-727111edca0f", + "position": [-32, 464], + "id": "246376de-5cc4-4fd2-9671-0a45b8bff10d", "name": "When clicking ‘Execute workflow’" }, { @@ -23,13 +23,13 @@ }, "type": "n8n-nodes-base.wordpress", "typeVersion": 1, - "position": [220, 0], - "id": "28b998b4-0ff7-4abb-bd3f-e6d62eeacb51", + "position": [192, 80], + "id": "36cf31d4-ad52-4bbc-8abf-bd384b6968f7", "name": "Page > Create", "credentials": { "wordpressApi": { - "id": "vNOAnwp9mSIq39cD", - "name": "nodeqa" + "id": "f5S0ZnKe8cDEPpjx", + "name": "Wordpress (localhost)" } } }, @@ -42,13 +42,13 @@ }, "type": "n8n-nodes-base.wordpress", "typeVersion": 1, - "position": [220, 200], - "id": "b32743c1-3f56-4ac0-8071-e3f4beb9af15", + "position": [192, 272], + "id": "236d9c67-319b-435f-94e1-1719f2752a72", "name": "Page > Get", "credentials": { "wordpressApi": { - "id": "vNOAnwp9mSIq39cD", - "name": "nodeqa" + "id": "f5S0ZnKe8cDEPpjx", + "name": "Wordpress (localhost)" } } }, @@ -61,13 +61,13 @@ }, "type": "n8n-nodes-base.wordpress", "typeVersion": 1, - "position": [220, 400], - "id": "5e5eacfd-58cd-49e0-b129-46ae235ec139", + "position": [192, 464], + "id": "b1a3788f-9c81-4591-8a4c-e138612d3fb2", "name": "Page > Get Many", "credentials": { "wordpressApi": { - "id": "vNOAnwp9mSIq39cD", - "name": "nodeqa" + "id": "f5S0ZnKe8cDEPpjx", + "name": "Wordpress (localhost)" } } }, @@ -84,13 +84,13 @@ }, "type": "n8n-nodes-base.wordpress", "typeVersion": 1, - "position": [220, 600], - "id": "441a92ae-5c9f-411e-866c-dbb820950246", + "position": [192, 848], + "id": "cac71c1a-3367-4d5b-ba8d-d2285934be4e", "name": "Page > Update", "credentials": { "wordpressApi": { - "id": "vNOAnwp9mSIq39cD", - "name": "nodeqa" + "id": "f5S0ZnKe8cDEPpjx", + "name": "Wordpress (localhost)" } } }, @@ -98,33 +98,62 @@ "parameters": {}, "type": "n8n-nodes-base.noOp", "typeVersion": 1, - "position": [440, 0], - "id": "840c6389-3a8e-43a2-bf51-cb463896e907", + "position": [416, 80], + "id": "bb846050-d39c-4e34-ad64-a97ccbbef256", "name": "Create Response" }, { "parameters": {}, "type": "n8n-nodes-base.noOp", "typeVersion": 1, - "position": [440, 200], - "id": "b659b27b-fa95-4cbf-b80e-5956ea03ac83", + "position": [416, 272], + "id": "9634f881-592c-4165-8f9c-5a1aad5f76ee", "name": "Get Response" }, { "parameters": {}, "type": "n8n-nodes-base.noOp", "typeVersion": 1, - "position": [440, 400], - "id": "d33fbb73-4204-43db-a88c-0b00cd65de3f", + "position": [416, 464], + "id": "4343c931-3ded-4505-950c-43ba56929692", "name": "Get Many Response" }, { "parameters": {}, "type": "n8n-nodes-base.noOp", "typeVersion": 1, - "position": [440, 600], - "id": "a50396a0-8838-4051-afa8-8ea13e4e75e4", + "position": [416, 848], + "id": "e159e8fa-a9c9-4f54-a941-29dc7983fd3a", "name": "Update Response" + }, + { + "parameters": { + "resource": "page", + "operation": "getAll", + "limit": 1, + "options": { + "before": "2026-01-01T00:00:00" + } + }, + "type": "n8n-nodes-base.wordpress", + "typeVersion": 1, + "position": [192, 656], + "id": "a08d9d51-e97f-4ea7-b189-d109b77e9f57", + "name": "Page > Get Many (With Filters)", + "credentials": { + "wordpressApi": { + "id": "f5S0ZnKe8cDEPpjx", + "name": "Wordpress (localhost)" + } + } + }, + { + "parameters": {}, + "type": "n8n-nodes-base.noOp", + "typeVersion": 1, + "position": [416, 656], + "id": "18c8cd20-de15-4ceb-9d6f-e4279532fe3c", + "name": "Get Many Response (With Filters)" } ], "pinData": { @@ -539,6 +568,96 @@ } } } + ], + "Get Many Response (With Filters)": [ + { + "json": { + "id": 2, + "date": "2025-03-27T18:05:01", + "date_gmt": "2025-03-27T18:05:01", + "guid": { + "rendered": "https://myblog.com/?page_id=2" + }, + "modified": "2025-03-27T18:05:01", + "modified_gmt": "2025-03-27T18:05:01", + "slug": "sample-page", + "status": "publish", + "type": "page", + "link": "https://myblog.com/sample-page/", + "title": { + "rendered": "Sample Page" + }, + "content": { + "rendered": "\n
This is an example page. It’s different from a blog post because it will stay in one place and will show up in your site navigation (in most themes). Most people start with an About page that introduces them to potential site visitors. It might say something like this:
\n\n\n\n\n\n\n\nHi there! I’m a bike messenger by day, aspiring actor by night, and this is my website. I live in Los Angeles, have a great dog named Jack, and I like piña coladas. (And gettin’ caught in the rain.)
…or something like this:
\n\n\n\n\n\n\n\nThe XYZ Doohickey Company was founded in 1971, and has been providing quality doohickeys to the public ever since. Located in Gotham City, XYZ employs over 2,000 people and does all kinds of awesome things for the Gotham community.
As a new WordPress user, you should go to your dashboard to delete this page and create new pages for your content. Have fun!
\n", + "protected": false + }, + "excerpt": { + "rendered": "This is an example page. It’s different from a blog post because it will stay in one place and will show up in your site navigation (in most themes). Most people start with an About page that introduces them to potential site visitors. It might say something like this: Hi there! I’m a bike messenger […]
\n", + "protected": false + }, + "author": 1, + "featured_media": 0, + "parent": 0, + "menu_order": 0, + "comment_status": "closed", + "ping_status": "open", + "template": "", + "meta": { + "footnotes": "" + }, + "class_list": ["post-2", "page", "type-page", "status-publish", "hentry"], + "_links": { + "self": [ + { + "href": "https://myblog.com/wp-json/wp/v2/pages/2", + "targetHints": { + "allow": ["GET", "POST", "PUT", "PATCH", "DELETE"] + } + } + ], + "collection": [ + { + "href": "https://myblog.com/wp-json/wp/v2/pages" + } + ], + "about": [ + { + "href": "https://myblog.com/wp-json/wp/v2/types/page" + } + ], + "author": [ + { + "embeddable": true, + "href": "https://myblog.com/wp-json/wp/v2/users/1" + } + ], + "replies": [ + { + "embeddable": true, + "href": "https://myblog.com/wp-json/wp/v2/comments?post=2" + } + ], + "version-history": [ + { + "count": 0, + "href": "https://myblog.com/wp-json/wp/v2/pages/2/revisions" + } + ], + "wp:attachment": [ + { + "href": "https://myblog.com/wp-json/wp/v2/media?parent=2" + } + ], + "curies": [ + { + "name": "wp", + "href": "https://api.w.org/{rel}", + "templated": true + } + ] + } + } + } ] }, "connections": { @@ -564,6 +683,11 @@ "node": "Page > Update", "type": "main", "index": 0 + }, + { + "node": "Page > Get Many (With Filters)", + "type": "main", + "index": 0 } ] ] @@ -611,17 +735,28 @@ } ] ] + }, + "Page > Get Many (With Filters)": { + "main": [ + [ + { + "node": "Get Many Response (With Filters)", + "type": "main", + "index": 0 + } + ] + ] } }, "active": false, "settings": { "executionOrder": "v1" }, - "versionId": "b20521c7-44b4-430b-9dab-72488f7b2d02", + "versionId": "b76bf6d6-3a62-4e01-938a-f63e55ef236b", "meta": { "templateCredsSetupCompleted": true, - "instanceId": "0fa937d34dcabeff4bd6480d3b42cc95edf3bc20e6810819086ef1ce2623639d" + "instanceId": "eeda9e3069aca300d1dfceeb64beb5b53d715db44a50461bbc5cb0cf6daa01e3" }, - "id": "QuWF8XwVEfFBCWjj", + "id": "W7kWl5BZvsrmZeVw", "tags": [] } diff --git a/packages/nodes-base/nodes/Wordpress/__tests__/workflow/post/post.test.ts b/packages/nodes-base/nodes/Wordpress/__tests__/workflow/post/post.test.ts index 69f6e93a9bc..42823241dcc 100644 --- a/packages/nodes-base/nodes/Wordpress/__tests__/workflow/post/post.test.ts +++ b/packages/nodes-base/nodes/Wordpress/__tests__/workflow/post/post.test.ts @@ -9,6 +9,10 @@ describe('Wordpress > Post Workflows', () => { const mock = nock(credentials.wordpressApi.url); mock.get('/wp-json/wp/v2/posts/1').reply(200, postGet); mock.get('/wp-json/wp/v2/posts').query({ per_page: 10, page: 1 }).reply(200, postGetMany); + mock + .get('/wp-json/wp/v2/posts') + .query({ per_page: 10, page: 1, before: '2026-01-01T00:00:00' }) + .reply(200, postGetMany); mock .post('/wp-json/wp/v2/posts', { title: 'New Post', diff --git a/packages/nodes-base/nodes/Wordpress/__tests__/workflow/post/post.workflow.json b/packages/nodes-base/nodes/Wordpress/__tests__/workflow/post/post.workflow.json index 5279b12be55..2fc6c19866b 100644 --- a/packages/nodes-base/nodes/Wordpress/__tests__/workflow/post/post.workflow.json +++ b/packages/nodes-base/nodes/Wordpress/__tests__/workflow/post/post.workflow.json @@ -5,16 +5,16 @@ "parameters": {}, "type": "n8n-nodes-base.manualTrigger", "typeVersion": 1, - "position": [-100, 100], - "id": "da734910-1187-408a-bfa9-1f38cd8faf73", + "position": [-32, 688], + "id": "d9528df2-82cb-47fe-8176-238283d1827e", "name": "When clicking ‘Execute workflow’" }, { "parameters": {}, "type": "n8n-nodes-base.noOp", "typeVersion": 1, - "position": [340, 0], - "id": "086a9b07-77ee-4c99-9d4e-05fdb63914a4", + "position": [416, 688], + "id": "1f61c57c-8bf3-44bd-86a7-651906c1b06d", "name": "Update Response" }, { @@ -30,13 +30,13 @@ }, "type": "n8n-nodes-base.wordpress", "typeVersion": 1, - "position": [120, 0], - "id": "11bb21ca-d2c2-4ac8-8559-a0f44adcb9a4", + "position": [192, 688], + "id": "eb2e2d7a-48e9-49fb-a808-e2546ce14a2b", "name": "Post > Update", "credentials": { "wordpressApi": { - "id": "vNOAnwp9mSIq39cD", - "name": "nodeqa" + "id": "f5S0ZnKe8cDEPpjx", + "name": "Wordpress (localhost)" } } }, @@ -48,13 +48,13 @@ }, "type": "n8n-nodes-base.wordpress", "typeVersion": 1, - "position": [120, -200], - "id": "01a19b2c-c0e6-49dc-9deb-4f1a52fbe9d4", + "position": [192, 304], + "id": "72a59773-a15a-4e58-8bed-be1108449550", "name": "Post > Get Many", "credentials": { "wordpressApi": { - "id": "vNOAnwp9mSIq39cD", - "name": "nodeqa" + "id": "f5S0ZnKe8cDEPpjx", + "name": "Wordpress (localhost)" } } }, @@ -62,8 +62,8 @@ "parameters": {}, "type": "n8n-nodes-base.noOp", "typeVersion": 1, - "position": [340, -200], - "id": "7353362c-e6dd-4812-b8e8-cc52044b0cf3", + "position": [416, 304], + "id": "11b128da-9b78-4f02-93a7-c3db1bc3363a", "name": "Get Many" }, { @@ -74,13 +74,13 @@ }, "type": "n8n-nodes-base.wordpress", "typeVersion": 1, - "position": [120, 200], - "id": "702ca685-91f4-416d-8f91-9a75409b8460", + "position": [192, 880], + "id": "3ff21988-4d92-4c87-831f-4e684248c761", "name": "Post > Get", "credentials": { "wordpressApi": { - "id": "vNOAnwp9mSIq39cD", - "name": "nodeqa" + "id": "f5S0ZnKe8cDEPpjx", + "name": "Wordpress (localhost)" } } }, @@ -88,8 +88,8 @@ "parameters": {}, "type": "n8n-nodes-base.noOp", "typeVersion": 1, - "position": [340, 200], - "id": "ca376415-c336-40ab-8ed7-7ddcf0d180cd", + "position": [416, 880], + "id": "dc730fc9-a28d-4eb4-aa8d-a1b85ff45ef9", "name": "Get Response" }, { @@ -100,23 +100,23 @@ "content": "This is my content", "slug": "new-post", "status": "future", + "date": "2025-03-27T18:30:04", "commentStatus": "closed", "pingStatus": "closed", "format": "standard", "sticky": true, - "categories": [1], - "date": "2025-03-27T18:30:04" + "categories": [1] } }, "type": "n8n-nodes-base.wordpress", "typeVersion": 1, - "position": [120, 400], - "id": "3a022ad5-8ce7-4ff2-988f-a449c7f1466e", + "position": [192, 1072], + "id": "f2e1c5f0-fbfa-419e-ba7a-ef60c8853304", "name": "Post > Create", "credentials": { "wordpressApi": { - "id": "vNOAnwp9mSIq39cD", - "name": "nodeqa" + "id": "f5S0ZnKe8cDEPpjx", + "name": "Wordpress (localhost)" } } }, @@ -124,9 +124,37 @@ "parameters": {}, "type": "n8n-nodes-base.noOp", "typeVersion": 1, - "position": [340, 400], - "id": "54e3d212-9d19-4aa1-ad32-1ca0cc64c32b", + "position": [416, 1072], + "id": "c386bee8-4bb9-4a1e-b4bc-4f8689722729", "name": "Create Response" + }, + { + "parameters": { + "operation": "getAll", + "returnAll": true, + "options": { + "before": "2026-01-01T00:00:00" + } + }, + "type": "n8n-nodes-base.wordpress", + "typeVersion": 1, + "position": [192, 496], + "id": "cc61993a-ac13-42d7-aace-c501da128361", + "name": "Post > Get Many (With Filters)", + "credentials": { + "wordpressApi": { + "id": "f5S0ZnKe8cDEPpjx", + "name": "Wordpress (localhost)" + } + } + }, + { + "parameters": {}, + "type": "n8n-nodes-base.noOp", + "typeVersion": 1, + "position": [416, 496], + "id": "770a6cf9-93ca-4b56-a23b-b1d9904de993", + "name": "Get Many (With Filters)" } ], "pinData": { @@ -691,6 +719,124 @@ } } } + ], + "Get Many (With Filters)": [ + { + "json": { + "id": 1, + "date": "2025-03-27T18:05:01", + "date_gmt": "2025-03-27T18:05:01", + "guid": { + "rendered": "https://myblog.com/?p=1" + }, + "modified": "2025-03-27T18:22:36", + "modified_gmt": "2025-03-27T18:22:36", + "slug": "hello-world", + "status": "publish", + "type": "post", + "link": "https://myblog.com/2025/03/27/hello-world/", + "title": { + "rendered": "Hello world!" + }, + "content": { + "rendered": "\nWelcome to WordPress. This is your first post. Edit or delete it, then start writing!
\n", + "protected": false + }, + "excerpt": { + "rendered": "Welcome to WordPress. This is your first post. Edit or delete it, then start writing!
\n", + "protected": false + }, + "author": 1, + "featured_media": 0, + "comment_status": "open", + "ping_status": "open", + "sticky": false, + "template": "", + "format": "standard", + "meta": { + "footnotes": "" + }, + "categories": [1], + "tags": [], + "class_list": [ + "post-1", + "post", + "type-post", + "status-publish", + "format-standard", + "hentry", + "category-uncategorised" + ], + "_links": { + "self": [ + { + "href": "https://myblog.com/wp-json/wp/v2/posts/1", + "targetHints": { + "allow": ["GET", "POST", "PUT", "PATCH", "DELETE"] + } + } + ], + "collection": [ + { + "href": "https://myblog.com/wp-json/wp/v2/posts" + } + ], + "about": [ + { + "href": "https://myblog.com/wp-json/wp/v2/types/post" + } + ], + "author": [ + { + "embeddable": true, + "href": "https://myblog.com/wp-json/wp/v2/users/1" + } + ], + "replies": [ + { + "embeddable": true, + "href": "https://myblog.com/wp-json/wp/v2/comments?post=1" + } + ], + "version-history": [ + { + "count": 1, + "href": "https://myblog.com/wp-json/wp/v2/posts/1/revisions" + } + ], + "predecessor-version": [ + { + "id": 6, + "href": "https://myblog.com/wp-json/wp/v2/posts/1/revisions/6" + } + ], + "wp:attachment": [ + { + "href": "https://myblog.com/wp-json/wp/v2/media?parent=1" + } + ], + "wp:term": [ + { + "taxonomy": "category", + "embeddable": true, + "href": "https://myblog.com/wp-json/wp/v2/categories?post=1" + }, + { + "taxonomy": "post_tag", + "embeddable": true, + "href": "https://myblog.com/wp-json/wp/v2/tags?post=1" + } + ], + "curies": [ + { + "name": "wp", + "href": "https://api.w.org/{rel}", + "templated": true + } + ] + } + } + } ] }, "connections": { @@ -716,6 +862,11 @@ "node": "Post > Create", "type": "main", "index": 0 + }, + { + "node": "Post > Get Many (With Filters)", + "type": "main", + "index": 0 } ] ] @@ -763,17 +914,28 @@ } ] ] + }, + "Post > Get Many (With Filters)": { + "main": [ + [ + { + "node": "Get Many (With Filters)", + "type": "main", + "index": 0 + } + ] + ] } }, "active": false, "settings": { "executionOrder": "v1" }, - "versionId": "2665dd64-c5ba-429b-a96d-c9ef88d22f35", + "versionId": "15a2bfaf-cdca-4010-81ee-e589d6fddc1e", "meta": { "templateCredsSetupCompleted": true, - "instanceId": "0fa937d34dcabeff4bd6480d3b42cc95edf3bc20e6810819086ef1ce2623639d" + "instanceId": "eeda9e3069aca300d1dfceeb64beb5b53d715db44a50461bbc5cb0cf6daa01e3" }, - "id": "TJ2kzGNKbZt6fvPV", + "id": "W7kWl5BZvsrmZeVw", "tags": [] }