Debugging and Logging

Willow has its own dedicated logging system and syntax and can be configured to write to the WordPress debug.log, which is located in the root of the wp-contents directory.
Version 2.0.5
Latest Changes:

* New: Two view filters added to allow for extension of custom and native WP templates - willow/view/native + willow/view/custom using .willow filetype

Documentation about each release is updated as often as possible, but may lag behind the Master Branch or other generated documentation.

Featured Work
Quinta de Sant’Ana, Portugal
Quinta de Sant’Ana, Portugal

Quinta de Sant'Ana overlooks the picturesque village of Gradil with its cobbled streets, white washed houses and hospitable inhabitants.


The WP_Debug constant must be set to true in the wp_config.php application in order to write to the log file and the Willow plugin public class property $_debug OR an external debug control must be set to true + debugging is controlled either on a context, context + task level or directly via template config->debug = true setting

Willow writes to the standard WordPress debug file, called debug.log, which is located in the root or the wp-contents directory.

Global Debugging

Willow load a global context file, located at library/willow/global.php – this includes top level settings, as follows:

As this file is located in the Willow plugin, it is not advised to change this directly, instead create a matching file in your own parent or child theme and place it is the same logical position – that is library/willow/global.php from the root folder of the active parent or child theme – there is no need to include this file directly, Willow should find it.

This is also possible from a plugin, if it has been registered correctly with Willow – Read more

Context or Task Debugging

As with global configuration, each context can also have a configuration file to define context level settings, this can be placed in the same location as the global.php, but named according to the context – some examples are:

  • ui.php control how ui context->tasks behave
  • post.php define settings for post tasks
  • module~search.php control settings for a specific task within the module context

In theory, all configuration could sit with one single, large, configuration file, but this quickly becomes unmanageable and less portable – so Willow both allows and encourages the creation of global, context and context+task specific files.

Within any of the configuration files listed above we can place any or all of the configuration options from global.php, re-defining the settings needed at a more granular level.

Note the naming convention of the files follows exactly the template usage – see this example:

{~ module~search ~} would load it’s configuration from module~search.php – with all the logic of fallbacks, priority and configuration merging taken into account.

Inline Debugging

In the following two examples, we are enabling debugging for the called Willow:

{~ [debug] group~frontpage_work{+ [array] 
	config->post = {% get_site_option{+ page_on_front +} %} 
+} ~}

~ OR ~

{~ group~frontpage_work{+ [array] 
	config = debug: true & 
	config->post = {% get_site_option{+ page_on_front +} %} 
+} ~}

The first example defines debugging via the [debug] flag, the second adds a configuration option via the array setter.

The result of this configuration setting will be to include a new key frontpage_work in the php debug output log, which will include important recorded events in the processing of the function data and output.


  • Many aspects of how the debugging process works can be controlled via filters, from the file location to the default log keys to include – in order to understand better how this works, please view the code