Created
May 29, 2021 14:24
-
-
Save mecmartini/05e8e1f9cadf51ff3715a7cf81557904 to your computer and use it in GitHub Desktop.
Drupal 7 - Programmatically delete nodes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $results = db_select('node', 'n') | |
| ->fields('n', ['nid']) | |
| ->condition('type', 'organisation') | |
| ->condition('nid', 35401, '<>') | |
| ->execute() | |
| ->fetchAll(); | |
| dpm($results); | |
| foreach ($results as $node) { | |
| node_delete($node->nid); | |
| } | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment