Massenlöschung von Beiträgen und Featured-Images in WordPress

Fortgeschritten

Dies ist ein Marketing-Bereich Automatisierungsworkflow mit 14 Nodes. Hauptsächlich werden If, Filter, HttpRequest, ManualTrigger und andere Nodes verwendet. Massenlöschung von Beiträgen und Featured Images in WordPress

Voraussetzungen
  • Möglicherweise sind Ziel-API-Anmeldedaten erforderlich

Kategorie

Workflow-Vorschau
Visualisierung der Node-Verbindungen, mit Zoom und Pan
Workflow exportieren
Kopieren Sie die folgende JSON-Konfiguration und importieren Sie sie in n8n
{
  "meta": {
    "instanceId": "90f9a6ef38ec632934192a5de51518245cd649d4287258dedc9971969910cdb7"
  },
  "nodes": [
    {
      "id": "268a318e-a605-40dc-b28f-b16ff038399d",
      "name": "Bild löschen",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1700,
        420
      ],
      "parameters": {
        "url": "={{ $('Change your Domain here').item.json.wpUrl }}/wp-json/wp/v2/media/{{ $json.id }}",
        "method": "DELETE",
        "options": {},
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "force",
              "value": "true"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "97381d8a-bcba-4ea6-9fce-ab56a1588c83",
      "name": "Bilder abrufen",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1520,
        420
      ],
      "parameters": {
        "url": "={{ $('Change your Domain here').item.json.wpUrl }}/wp-json/wp/v2/media/{{ $('Filter').item.json.featured_media }}",
        "options": {}
      },
      "typeVersion": 4.2
    },
    {
      "id": "07eb4f65-da06-413b-af1e-98504dc6050c",
      "name": "Artikel abrufen",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        600,
        580
      ],
      "parameters": {
        "url": "={{ $('Change your Domain here').item.json.wpUrl }}/wp-json/wp/v2/posts",
        "options": {},
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "status",
              "value": "pending"
            },
            {
              "name": "order",
              "value": "asc"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "c18c430f-98d9-4e7c-9688-3cc2cfa5daa3",
      "name": "Artikel löschen",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1880,
        600
      ],
      "parameters": {
        "url": "={{ $('Change your Domain here').item.json.wpUrl }}/wp-json/wp/v2/posts/{{ $('Filter').item.json.id }}",
        "method": "DELETE",
        "options": {},
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "force",
              "value": "true"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "0d00aa0f-c030-489d-a7e1-744cdf0c1c7b",
      "name": "Filter",
      "type": "n8n-nodes-base.filter",
      "position": [
        900,
        580
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "d099ced6-1ad2-4b37-a877-435b4f14537c",
              "operator": {
                "type": "number",
                "operation": "lt"
              },
              "leftValue": "={{ $itemIndex }}",
              "rightValue": 1
            }
          ]
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "1f6f520f-35f1-4424-9cec-431175c42c0f",
      "name": "Hat Bild",
      "type": "n8n-nodes-base.if",
      "position": [
        1200,
        580
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "c1c1463c-be82-4ba0-9dd3-280dec6c2924",
              "operator": {
                "type": "number",
                "operation": "notEquals"
              },
              "leftValue": "={{ $('Filter').item.json.featured_media }}",
              "rightValue": 0
            }
          ]
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "36465680-6de2-484a-94e0-e7778b0ed7ef",
      "name": "Notiz",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        800,
        240
      ],
      "parameters": {
        "width": 297.80842911877414,
        "height": 512.4904214559392,
        "content": "## Approvals\nBuilt out your approval process here.\n\nEither use this workflow as a manually-driven time saver. Or split it into two workflows with your approvals in an external app like Slack or email. \"Approve\" link in the external message should fire a webhook that triggers the second half of this workflow with idintifiable post info (ie. post `id` and `featured_media`)"
      },
      "typeVersion": 1
    },
    {
      "id": "3e200e7f-f14b-4897-a1b1-274256fa72a7",
      "name": "Notiz2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1100,
        240
      ],
      "parameters": {
        "color": 4,
        "width": 317.5478927203068,
        "height": 512.4904214559392,
        "content": "## Router\nThis step detects if the post has a featured image associated."
      },
      "typeVersion": 1
    },
    {
      "id": "9f017854-e445-409f-a465-5eef1c09e891",
      "name": "Notiz4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1420,
        240
      ],
      "parameters": {
        "color": 6,
        "width": 696.8275862068976,
        "height": 512.4904214559392,
        "content": "## This is the Magic\nIf the post has a featured media associated, the workflow will first deleted that media, then delete the post.\n\nIf it has no media associated, then the workflow simply deletes the post."
      },
      "typeVersion": 1
    },
    {
      "id": "b82386f4-f759-40ac-b89a-43815875882c",
      "name": "Notiz3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        200,
        240
      ],
      "parameters": {
        "color": 5,
        "width": 297.80842911877414,
        "height": 512.4904214559392,
        "content": "## Trigger\nThis workflow is set up for bulk/batch deletion of many WordPress posts.\n\nIt has been pre-loaded with the property `wpUrl` set to 'https://setyourwordpresshere.com' - which you should change to your site's domain.\n\nYou could modify this into your post approval or editorial process, in which case you'd use a different trigger, maybe when a post in WP is saved (you can also filter based on `stats`, ie. when a post with `status` **'pending review'** is created)."
      },
      "typeVersion": 1
    },
    {
      "id": "03d113e5-c1c0-4dab-ac64-c6a9388b9d91",
      "name": "Notiz5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        500,
        240
      ],
      "parameters": {
        "color": 3,
        "width": 297.80842911877414,
        "height": 512.4904214559392,
        "content": "## Get Your Posts\n**IMPORTANT:** Be sure to add your authentication for WordPress in the HTTP Request node.\n\nThis request will return all `pending` status posts, ordered by *date, descending*. So it returns the oldest pending posts first. You can adjust these parameters, as well as add other filters like `categories`, etc."
      },
      "typeVersion": 1
    },
    {
      "id": "72d4044c-8e62-43dc-8fd7-0b3fc9accbca",
      "name": "Artikel mit Bild löschen",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1880,
        420
      ],
      "parameters": {
        "url": "={{ $('Change your Domain here').item.json.wpUrl }}/wp-json/wp/v2/posts/{{ $('Filter').item.json.id }}",
        "method": "DELETE",
        "options": {},
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "force",
              "value": "true"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "3ccd76b6-8b6f-462e-bb29-a539b7a8e286",
      "name": "Notiz1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2120,
        240
      ],
      "parameters": {
        "color": 7,
        "width": 286.52873563218395,
        "height": 512.490421455939,
        "content": "## Expansion\nYou might consider storing the results of the deleted posts to a data storage tool like Airtable, Nocodb, Sheets, or a database, for good record keeping."
      },
      "typeVersion": 1
    },
    {
      "id": "ac2c0f9a-ed6a-44cc-8ac7-0498187133e4",
      "name": "Domain hier ändern",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        300,
        580
      ],
      "parameters": {},
      "typeVersion": 1
    }
  ],
  "pinData": {
    "Change your Domain here": [
      {
        "wpUrl": "https://setyourwordpresshere.com"
      }
    ]
  },
  "connections": {
    "0d00aa0f-c030-489d-a7e1-744cdf0c1c7b": {
      "main": [
        [
          {
            "node": "1f6f520f-35f1-4424-9cec-431175c42c0f",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "1f6f520f-35f1-4424-9cec-431175c42c0f": {
      "main": [
        [
          {
            "node": "97381d8a-bcba-4ea6-9fce-ab56a1588c83",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "c18c430f-98d9-4e7c-9688-3cc2cfa5daa3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "97381d8a-bcba-4ea6-9fce-ab56a1588c83": {
      "main": [
        [
          {
            "node": "268a318e-a605-40dc-b28f-b16ff038399d",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "07eb4f65-da06-413b-af1e-98504dc6050c": {
      "main": [
        [
          {
            "node": "0d00aa0f-c030-489d-a7e1-744cdf0c1c7b",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "268a318e-a605-40dc-b28f-b16ff038399d": {
      "main": [
        [
          {
            "node": "72d4044c-8e62-43dc-8fd7-0b3fc9accbca",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ac2c0f9a-ed6a-44cc-8ac7-0498187133e4": {
      "main": [
        [
          {
            "node": "07eb4f65-da06-413b-af1e-98504dc6050c",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Häufig gestellte Fragen

Wie verwende ich diesen Workflow?

Kopieren Sie den obigen JSON-Code, erstellen Sie einen neuen Workflow in Ihrer n8n-Instanz und wählen Sie "Aus JSON importieren". Fügen Sie die Konfiguration ein und passen Sie die Anmeldedaten nach Bedarf an.

Für welche Szenarien ist dieser Workflow geeignet?

Fortgeschritten - Marketing

Ist es kostenpflichtig?

Dieser Workflow ist völlig kostenlos. Beachten Sie jedoch, dass Drittanbieterdienste (wie OpenAI API), die im Workflow verwendet werden, möglicherweise kostenpflichtig sind.

Workflow-Informationen
Schwierigkeitsgrad
Fortgeschritten
Anzahl der Nodes14
Kategorie1
Node-Typen5
Schwierigkeitsbeschreibung

Für erfahrene Benutzer, mittelkomplexe Workflows mit 6-15 Nodes

Externe Links
Auf n8n.io ansehen

Diesen Workflow teilen

Kategorien

Kategorien: 34