Title: Trigger Browsersync
Author: Patabugen
Published: <strong>Igbe 7, 2017</strong>
Last modified: Òkúdù 23, 2022

---

Ṣàwárí àwọn plugin

Plugin yìí **kò tíì ṣe àyẹ̀wò pẹ̀lú àwọn ìtújáde mẹ́ta pàtàkì tó kẹ́yìn ti WordPress**.
Ó lè jẹ́ pé a kò tọ́jú tàbí ṣe àtìlẹ́yìn fún un mọ́, ó sì lè ní àwọn ọ̀ràn ìbámu
nígbà tí a bá lò ó pẹ̀lú àwọn ẹ̀yà WordPress tuntun.

![](https://ps.w.org/trigger-browsersync/assets/icon-256x256.png?rev=1634350)

# Trigger Browsersync

 Láti ọwọ́ [Patabugen](https://profiles.wordpress.org/patabugen/)

[Ṣe ìgbàsílẹ̀](https://downloads.wordpress.org/plugin/trigger-browsersync.zip)

 * [Àwọn àlàyé](https://yor.wordpress.org/plugins/trigger-browsersync/#description)
 * [Àwọn àgbéyẹ̀wò](https://yor.wordpress.org/plugins/trigger-browsersync/#reviews)
 *  [Ìgbéwọlẹ̀](https://yor.wordpress.org/plugins/trigger-browsersync/#installation)
 * [Ìdàgbàsókè](https://yor.wordpress.org/plugins/trigger-browsersync/#developers)

 [Ìrànlọ́wọ́](https://wordpress.org/support/plugin/trigger-browsersync/)

## Àpèjúwe

Integrates WordPress with Browsersync to trigger events like reload when you edit
pages.

The plugin also only triggers a reload for now. If you have requests or ideas for
other functionality, get in touch.

Since you (should) disable this plugin on production sites, the WordPress stats 
wonÌtumọ̀ Yorùbá: ’t be reliable Ìtumọ̀ Yorùbá: – if you find the plugin useful 
IÌtumọ̀ Yorùbá: ’d really appreciate it if youÌtumọ̀ Yorùbá: ’d let me know with
a quick email or message!

#### Triggers

By default the plugin will trigger a reload on these actions:

 * save_post Ìtumọ̀ Yorùbá: – Editing posts/pages/custom posts etc
 * added_option Ìtumọ̀ Yorùbá: – Changing settings
 * attachment_updated Ìtumọ̀ Yorùbá: – Editing media fields (caption etc)
 * updated_postmeta Ìtumọ̀ Yorùbá: – Covers many things, particularly regenerating
   media thumbnails. Some meta_fields are ignored (see `trigger_browsersync_irrelevant_meta_keys`)
 * activated_plugin
 * deactivated_plugin
 * delete_widget

you can customise this as well as other Browsersync settings using filters:

    ```
    add_filter('trigger_browsersync_reload_actions', function($filters) {
        // Remove a default. Bear in mind that one action you take (e.g. saving a page)
        // may trigger more than one hook.
        unset($filters['save_post']);
        // Add your own. The key name lets other filters remove it (like the line above)
        $filters['wp_logout'] = 'wp_logout';
        return $filters;
    });
    ```

#### Ignoring Meta Keys

Not all meta_key updates (triggered by `updated_postmeta`) have any impact on the
front-end functioning of your site. You can customise which `meta_key` values are
ignored with the `trigger_browsersync_irrelevant_meta_keys` filter:

    ```
    add_filter('trigger_browsersync_irrelevant_meta_keys', function($filters) {
        // Remove a default.
        unset($filters['_edit_lock']);
        // Add your own. The key name lets other filters remove it (like the line above)
        $filters['_edit_lock'] = '_edit_lock';
        return $filters;
    });
    ```

#### Configuration with Filters

The default Browsersync settings will be used (`http://localhost:3000`) but you 
can use filters to change them. The filters are used every time the trigger is activated
so you donÌtumọ̀ Yorùbá: ’t need to set them before instanciating the class.

    ```
    add_filter('trigger_browsersync_protocol', function(){ return 'https'; } );
    add_filter('trigger_browsersync_host', function(){ return 'dev.server'; } );
    add_filter('trigger_browsersync_port', function(){ return '4321'; } );
    ```

Or you can specify the whole URL which will cause the others to be ignored, but 
donÌtumọ̀ Yorùbá: ’t include a trailing slash.

    ```
    add_filter('trigger_browsersync_url', function(){ return 'http://localhost:3000'; } );
    ```

#### Environmental Configuration

Since you probably only want Browsersync on your development or staging site, the
plugin will do nothing once you activate it it in WordPress.

To make it work, youÌtumọ̀ Yorùbá: ’ll want to create a file to activate it. See
Installation for instructions.

#### Logging Activity

Trigger Browsersync can log events to the WordPress log Ìtumọ̀ Yorùbá: – this is
especially useful for development on the plugin when you want to add or exclude 
a new event from triggering an action.

To enable logging add this filter to your `enable-trigger-browsersync.php` file (
see Installation);

    ```
    add_filter('trigger_browsersync_log_events', '__return_true');
    ```

## Ìgbéwọlẹ̀

This plugin sends signals to an existing and running BrowserSync setup. You need
to install Browsersync and integrate it with your workflow first Ìtumọ̀ Yorùbá: –
how do to that is outside the scope of the plugin but you can get more information
at [BrowserSync.io](https://www.browsersync.io/).

Install the plugin by uploading or via the plugin option in WordPress Ìtumọ̀ Yorùbá:–
the same as any other plugin.

The plugin will do nothing unless you create an instance of `TriggerBrowsersync`
somewhere.

You probably donÌtumọ̀ Yorùbá: ’t want the integration on your production server,
which means you donÌtumọ̀ Yorùbá: ’t want the code to instanciate saved in your 
repo Ìtumọ̀ Yorùbá: – I would recommend you create a file in mu-plugins with the
code below, and then tell your version control to ignore the file.

    ```
    <?php
    add_action( 'plugins_loaded', function(){ // Trigger after the TriggerBrowsersync plugin has loaded
        if ( class_exists( 'TriggerBrowsersync' ) ) { // Check the TriggerBrowsersync plugin loaded correctly
            // Add any configuration filters you may need here.

            // Activate the integration by creating an instance.
            new TriggerBrowsersync();
        }
    } );
    ```

#### Step by Step Example Installation

 * Create `wp-content/mu-plugins/enable-trigger-browsersync.php` (you may need to
   create the `mu-plugins` directory)
 * Paste the code above in
 * Edit .gitignore and add `wp-content/mu-plugins/enable-trigger-browsersync.php`

#### All Hooks and Filters

Use filters to customise settings:

 * trigger_browsersync_protocol Ìtumọ̀ Yorùbá: – set the protocol for Gulp Watch(
   probably http or https). Defaults to http.
 * trigger_browsersync_host Ìtumọ̀ Yorùbá: – set the host port for Gulp Watch. Defaults
   to localhost
 * trigger_browsersync_port Ìtumọ̀ Yorùbá: – set the port for Gulp Watch. Defaults
   to 3000
 * trigger_browsersync_url Ìtumọ̀ Yorùbá: – Set the whole URL instead of the parts
   above (e.g. http://localhost:3000)
 * trigger_browsersync_reload_actions Ìtumọ̀ Yorùbá: – add/change the actions on
   which to trigger a reload. See source for defaults.
 * trigger_browsersync_log_events Ìtumọ̀ Yorùbá: – Return true to enable log output(
   to the standard log)
 * trigger_browsersync_irrelevant_meta_keys Ìtumọ̀ Yorùbá: – Lets you ignore particular
   meta_keys or options
 * trigger_browsersync_irrelevant_meta_key_regex Ìtumọ̀ Yorùbá: – Lets you ignore
   particular meta_keys or options if they match preg_match

You can also hook on to some actions if you wish:

 * trigger_browsersync_before Ìtumọ̀ Yorùbá: – Called just before we trigger anything
 * trigger_browsersync_after Ìtumọ̀ Yorùbá: – Called just before we trigger anything
 * trigger_browsersync_before_reload Ìtumọ̀ Yorùbá: – Called just before we trigger
   a reload
 * trigger_browsersync_after_reload Ìtumọ̀ Yorùbá: – Called just after we trigger
   a reload Ìtumọ̀ Yorùbá: – the reload wonÌtumọ̀ Yorùbá: ’t yet be done

## FAQ

### IÌtumọ̀ Yorùbá: ’ve installed the plugin, but itÌtumọ̀ Yorùbá: ’s not doing anything.

 * Have you followed the installation instructions? The plugin will do nothing without
   them.
    - If youÌtumọ̀ Yorùbá: ’re not using the default Browser Sync settings, youÌtumọ̀
      Yorùbá: ’ll need to add filters to override them.

## Àwọn àgbéyẹ̀wò

![](https://secure.gravatar.com/avatar/e237c2d23fd717ca792f0c6a76d0aacedec4a336efb6aa65cfabf1db5fac6f6f?
s=60&d=retro&r=g)

### 󠀁[What a time saver!](https://wordpress.org/support/topic/what-a-time-saver-29/)󠁿

 [mark l chaves](https://profiles.wordpress.org/mlchaves/) Ọ̀pẹ 28, 2019 2 àwọn 
ìdáhùn

Thank goodness we have the Trigger Browsersync WordPress plugin by Sami Greenbury.
And, I love the way it piggy backs onto Browsersync (loose coupling). You will need
to follow the install instructions carefully. And, the big prerequisite is knowing
how to set up Browsersync of course. Knowing Gulp would be even better. If you arenÌtumọ̀
Yorùbá: ’t comfortable wading through PHP and JavaScript, this plugin might be too
intimidating. But, I highly recommend giving it a try because it will save you tons
of dev time. Assuming you have a local WordPress dev env and are working on a lot
of WordPress sites. I did find a teeny bug (typo) that can be easily fixed. If you
run into it too, then change “emssage” to “message” on line 275 in the trigger-browsersync.
php file. I posted about this in the support forum. If you have any issues at all
with the set up, I suggest turning on your PHP debugging and telling the Trigger
Browsersync plugin to log events via a filter. See the plugin details page. A couple
FYIs 1) This plugin does not seem to watch PHP and CSS updates. I have Gulp file
that instantiates Browsersync reloads my browser on any PHP and CSS file changes.
This setup runs perfectly with this plugin. I didnÌtumọ̀ Yorùbá: ’t have to change
a thing in my Gulp file. 2) There has not been any plugin updates for 9 months at
the time of this post.

![](https://secure.gravatar.com/avatar/e375f8b274badb1c1c5d360299feaba06ec1658a48a3fe983d77ca149b93b15c?
s=60&d=retro&r=g)

### 󠀁[Very useful](https://wordpress.org/support/topic/very-useful-1991/)󠁿

 [certainlyakey](https://profiles.wordpress.org/certainlyakey/) Ògún 15, 2019 1 
ìdáhùn

Strangely it doesnÌtumọ̀ Yorùbá: ’t work if you add the new TriggerBrowsersync();
call to a themeÌtumọ̀ Yorùbá: ’s functions.php (i added it to an include that is
git ignored), but it does work if you do as the author said, put it into mu-plugins.
Excellent plugin, thanks!

![](https://secure.gravatar.com/avatar/a581a277c5716eaea4f28e52176a19655b278a9b1ffeb09557e470bea50b7443?
s=60&d=retro&r=g)

### 󠀁[Fantastic!](https://wordpress.org/support/topic/fantastic-1728/)󠁿

 [octoninjacat](https://profiles.wordpress.org/octoninjacat/) Ẹrẹ́nà 3, 2018

This is fantastic! IÌtumọ̀ Yorùbá: ’m using this with the JointsWP theme and it 
works flawlessly. Definitely a must use plugin!

 [ Ka gbogbo àwọn àgbéyẹ̀wò 3 ](https://wordpress.org/support/plugin/trigger-browsersync/reviews/)

## Àwọn Olùkópa & Olùgbéejáde

“Trigger Browsersync” jẹ́ ètò ìṣàmúlò orísun ṣíṣí sílẹ̀. Àwọn ènìyàn wọ̀nyí ti ṣe
ìkópa sí plugin yìí.

Àwọn Olùkópa

 *   [ Patabugen ](https://profiles.wordpress.org/patabugen/)

[Túmọ̀ “Trigger Browsersync” sí èdè rẹ.](https://translate.wordpress.org/projects/wp-plugins/trigger-browsersync)

### Ṣe o nífẹ̀ẹ́ sí ìdàgbàsókè?

[Ṣàwárí koodu](https://plugins.trac.wordpress.org/browser/trigger-browsersync/),
ṣàyẹ̀wò [ibi ìpamọ́ SVN](https://plugins.svn.wordpress.org/trigger-browsersync/),
tàbí ṣe àgbékalẹ̀ sí [àkọsílẹ̀ ìdàgbàsókè](https://plugins.trac.wordpress.org/log/trigger-browsersync/)
nípasẹ̀ [RSS](https://plugins.trac.wordpress.org/log/trigger-browsersync/?limit=100&mode=stop_on_copy&format=rss).

## Àkọsílẹ̀ àwọn àyípadà

#### 0.8.6

 * Tested with WordPress 6

#### 0.8.5

 * Tested with WordPress 5.3
 * Fixed typo bug.

#### 0.8.4

 * Tested with WordPress 5.1

#### 0.8.3

 * DonÌtumọ̀ Yorùbá: ’t trigger reload on cron updates.
 * Handle logging non-string value types better.

#### 0.8

 * Fixed bug where non-string option values would throw a fatal error

#### 0.7

 * Added `trigger_browsersync_irrelevant_meta_key_regex` filter to let us ignore
   meta keys or options based on a regex match. Initial value excludes any meta_key
   or option mame containing ‘cache’
 * Fixed bug whereby options being changed were not logged properly
 * Added the `trigger_browsersync_irrelevant_meta_keys` to options names
 * Added `updated_option` to compliment existing `added_option`

#### 0.6

 * Added `delete_widget` hook

#### 0.5

 * Initial release with reload functionality, custom settings and customisable hook/
   trigger list.

## Àkójọpọ̀ Meta

 *  Ẹ̀yà **0.8.6**
 *  Ìgbàgbọ́hùn tó kẹ́yìn **ọdún 4 sẹ́yìn**
 *  Àwọn ìgbéwọlẹ̀ tó ṣiṣẹ́ **10+**
 *  Ẹ̀yà WordPress ** 3.0.1 tàbí ju bẹ́ẹ̀ lọ **
 *  Èdè
 * [English (US)](https://wordpress.org/plugins/trigger-browsersync/)
 * Àwọn àmì
 * [automation](https://yor.wordpress.org/plugins/tags/automation/)[dev](https://yor.wordpress.org/plugins/tags/dev/)
   [refresh](https://yor.wordpress.org/plugins/tags/refresh/)
 *  [Ìwòye Tó Péye](https://yor.wordpress.org/plugins/trigger-browsersync/advanced/)

## Àwọn ìbò

 4.7 lára àwọn ìràwọ̀ 5.

 *  [  2 5-star reviews     ](https://wordpress.org/support/plugin/trigger-browsersync/reviews/?filter=5)
 *  [  1 4-star review     ](https://wordpress.org/support/plugin/trigger-browsersync/reviews/?filter=4)
 *  [  0 3-star reviews     ](https://wordpress.org/support/plugin/trigger-browsersync/reviews/?filter=3)
 *  [  0 2-star reviews     ](https://wordpress.org/support/plugin/trigger-browsersync/reviews/?filter=2)
 *  [  0 1-star reviews     ](https://wordpress.org/support/plugin/trigger-browsersync/reviews/?filter=1)

[Your review](https://wordpress.org/support/plugin/trigger-browsersync/reviews/#new-post)

[See all reviews](https://wordpress.org/support/plugin/trigger-browsersync/reviews/)

## Àwọn Olùkópa

 *   [ Patabugen ](https://profiles.wordpress.org/patabugen/)

## Ìrànlọ́wọ́

Nǹkan wà tí o fẹ́ sọ? Ṣé o nílò ìrànlọ́wọ́?

 [Wo àpéjọ ìrànlọ́wọ́](https://wordpress.org/support/plugin/trigger-browsersync/)

## Ṣe ìtọrẹ

Ṣé o fẹ́ ṣe àtìlẹ́yìn fún ìlọsíwájú plugin yìí?

 [ Ṣe ìtọrẹ sí plugin yìí ](https://paypal.me/patabugen/5)