$templates


Methods

$templates->delete($template)

Introduced in Version 2.0

Description

Delete the given template instance. Note that this will throw a fatal error if the template is in use by any pages.

Each ProcessWire template has an associated fieldgroup. When deleting a template using the API, we also need to delete its associated fieldgroup as shown in the following example.

$t = $templates->get("skyscraper");
$templates->delete($t);
$fieldgroups->delete($t->fieldgroup);

Related

Post Comment