Title: Default template args filter
Last modified: September 14, 2021

---

# Default template args filter

 *  [Joseph D’Souza](https://wordpress.org/support/users/dsouzaj86/)
 * (@dsouzaj86)
 * [4 years, 8 months ago](https://wordpress.org/support/topic/default-template-args-filter/)
 * Would be nice if it was possible to have a filter for the `template::OPTIONS`
   property. It’s a constant right now, but if it became a local property of the`
   template` class, then within the constructor it would be possible to add a filter
   to override the default values. An example use case would be if you wanted to
   enable linkify across all emails by default, you could do it once on the filter,
   rather than defining at template level for every instance.
 * It might look like this
 *     ```
       public function __construct($slug=null) {
       	global $wpdb;
   
       	// Reset.
       	$this->template = static::TEMPLATE;
   
       	// Pluck a template.
       	if (false === ($slug = static::ab($slug))) {
       		return false;
       	}
   
       	// And get the content.
       	$dbResult = $wpdb->get_results("
       		SELECT
       			<code>post_content</code> AS <code>raw</code>,
       			<code>post_name</code> AS <code>slug</code>,
       			<code>post_title</code> AS <code>title</code>
       		FROM <code>{$wpdb->prefix}posts</code>
       		WHERE
       			<code>post_type</code>='wh-template' AND
       			<code>post_status</code>='publish' AND
       			<code>post_name</code>='" . \esc_sql($slug) . "'
       	");
       	if (! isset($dbResult[0])) {
       		return false;
       	}
       	$Row = common\data::array_pop_top($dbResult);
       	$this->template = common\data::parse_args($Row, static::TEMPLATE);
   
       	$this->defaults = \apply_filters('wh_default_options', self::OPTIONS, $this->template['slug']); // <-- HERE
   
       	return true;
       }
       ```
   
 * Also, just over a year ago you said that the plugin source would be available“
   in about a year”, so that it would be possible to contribute to the plugin. Any
   word on this, please?
    -  This topic was modified 4 years, 8 months ago by [Joseph D'Souza](https://wordpress.org/support/users/dsouzaj86/).
      Reason: Tidy up code mistake
    -  This topic was modified 4 years, 8 months ago by [Joseph D'Souza](https://wordpress.org/support/users/dsouzaj86/).
      Reason: further tidy up code mistake

Viewing 1 replies (of 1 total)

 *  Plugin Author [Blobfolio](https://wordpress.org/support/users/blobfolio/)
 * (@blobfolio)
 * [4 years, 8 months ago](https://wordpress.org/support/topic/default-template-args-filter/#post-14872118)
 * Hey [@dsouzaj86](https://wordpress.org/support/users/dsouzaj86/),
 * Sorry about that. COVID _and_ cancer have derailed that original timeline. Haha.
 * The main holdup is the plugin needs new build scripts. The current process is
   just a hacky stopgap, not contributor-friendly.
 * If you want to shoot me an email (josh@blobfolio.com), I can zip up and send 
   you the sources. It should give you a decent jumping-off point if you wanted 
   to fork the project.

Viewing 1 replies (of 1 total)

The topic ‘Default template args filter’ is closed to new replies.

 * ![](https://ps.w.org/well-handled/assets/icon-256x256.png?rev=2889647)
 * [Well-Handled Email Templates](https://wordpress.org/plugins/well-handled/)
 * [Support Threads](https://wordpress.org/support/plugin/well-handled/)
 * [Active Topics](https://wordpress.org/support/plugin/well-handled/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/well-handled/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/well-handled/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Blobfolio](https://wordpress.org/support/users/blobfolio/)
 * Last activity: [4 years, 8 months ago](https://wordpress.org/support/topic/default-template-args-filter/#post-14872118)
 * Status: not resolved