Results 1 to 3 of 3

Thread: Bulk deleting drupal content nodes

  1. #1
    Join Date
    Jan 2009
    Posts
    86

    Bulk deleting drupal content nodes

    Can anyone provide me the Code for deleting 50 nodes at a time in drupal software.I would really appreciate that person.

  2. #2
    Join Date
    May 2008
    Posts
    2,297

    Re: Bulk deleting drupal content nodes

    In this example i am going to delete all nodes of a particular type (page), a quick way to execute the code is to create a new node, set the input format to PHP, paste the code into the node body - add a title and click submit -


    <?php
    $node_type = 'page';

    //fetch the nodes we want to delete
    $result = db_query("SELECT nid FROM {node} WHERE type='%s'",$node_type);
    while ($row = db_fetch_object($result)){
    node_delete($row->nid);
    $deleted_count+=1;
    }
    //simple debug message so we can see what had been deleted.
    drupal_set_message('$deleted_count nodes have been deleted');
    ?>

    Note:- Don't forget to delete the node when your done.

  3. #3
    Join Date
    Jan 2009
    Posts
    86

    Re: Bulk deleting drupal content nodes

    Thanks a lot it worked for me

Similar Threads

  1. Replies: 6
    Last Post: 28-03-2012, 08:50 PM
  2. How to get distance (hops) between NUMA nodes?
    By Aaryn in forum Windows Software
    Replies: 7
    Last Post: 27-09-2010, 11:13 AM
  3. Clear Content in cell without deleting formula
    By ARTHUR18 in forum Windows Software
    Replies: 3
    Last Post: 05-06-2009, 11:03 AM
  4. No suitable nodes are available to serve your request
    By dalsandhu in forum Networking & Security
    Replies: 3
    Last Post: 27-05-2009, 07:33 PM
  5. How to Handle Content Management system in Drupal + PHP
    By StudyBoy in forum Software Development
    Replies: 3
    Last Post: 19-03-2009, 04:23 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,262,613.90347 seconds with 17 queries