Skip to content

Instantly share code, notes, and snippets.

@certainlyakey
Created August 15, 2019 17:46
Show Gist options
  • Save certainlyakey/7e2b8ad507af0e7fba78bc2e5b2f4f80 to your computer and use it in GitHub Desktop.
Save certainlyakey/7e2b8ad507af0e7fba78bc2e5b2f4f80 to your computer and use it in GitHub Desktop.
Activate Browsersync reload on admin actions Wordpress plugin (requires Trigger Browsersync plugin)
<?php
/*
Plugin Name: Activate Browsersync
Plugin URI: https://wordpress.org/plugins/trigger-browsersync/
Description: Activates Browsersync. Doesn't do anything without <a href="https://wordpress.org/plugins/trigger-browsersync/">Trigger Browsersync</a> plugin. This plugin code should be only present in local environment.
Version: 0.0.1
Author: Sami Greenbury
Author URI: https://www.patabugen.co.uk/
*/
add_action( 'plugins_loaded', function() { // Trigger after the TriggerBrowsersync plugin has loaded
if ( class_exists( 'TriggerBrowsersync' ) ) {
// Add any configuration filters you may need here.
add_filter( 'trigger_browsersync_host', function() {
return '192.168.1.245';
});
new TriggerBrowsersync();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment