Search the blog

This helpful but of code adds an edit link to a page using the ProcessWire platform. Add this to generate the link:


if (wire('page')->editable() === true) {

	echo '<a href="' . wire('page')->editUrl . '">Edit page</a>';

}

The editable() function handles all the checking of permissions so the user must:

  1. Be logged in
  2. Have the correct permissions
Tim Bennett is a web designer and developer. He has a First Class Honours degree in Computing from Leeds Metropolitan University and currently runs his own one-man web design company, Texelate.