Created
April 19, 2017 20:08
-
-
Save froboy/915d7921c0cacdee923008adb188e180 to your computer and use it in GitHub Desktop.
Drupal (7) VBO snippet - Turn on pathauto & Remove redirects
This file contains 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
// This script can be run via Views Bulk Operations in the "Execute arbitrary PHP code" op | |
// This is, obviously, at your own risk. I'd take a db backup first. | |
// Force "Generate alias automatically" to be TRUE, then save the node. | |
$entity->path['pathauto'] = TRUE; | |
node_save($entity); | |
// Remove any stray redirects so that there's one true URL | |
$deleted = db_delete('redirect') | |
->condition('redirect', 'node/' . $entity->nid) | |
->execute(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment