Skip to content

Instantly share code, notes, and snippets.

@LostKobrakai
Last active August 29, 2015 14:06
Show Gist options
  • Save LostKobrakai/9dbfb29ee8d1515bcd69 to your computer and use it in GitHub Desktop.
Save LostKobrakai/9dbfb29ee8d1515bcd69 to your computer and use it in GitHub Desktop.
ProcessWire: Remove field via API
<?php
if ($user->isSuperuser()) {
//first remove the fields from 'user' template before deleting them.
$t = $templates->get('user');
$fg = $t->fieldgroup;
$fg->remove($fields->get('your_field'));
$fg->save();
//delete the fields
$f = $fields->get('your_field');
$fields->delete($f);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment