Skip to content

Commit 2dbe340

Browse files
committed
Wait for feature plugins to load prior to setting up auto-distribution.
1 parent 54978aa commit 2dbe340

3 files changed

Lines changed: 7 additions & 1 deletion

File tree

docs/auto-distribution.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ To enable auto-distribution, you can include this code in your site's feature pl
66
add_filter( 'dt_auto_distribution_enabled', '__return_true' );
77
```
88

9+
This code must run prior to or on the `plugins_loaded` hook. If running on the `plugins_loaded` hook, it must do so at priority 19 or lower.
10+
911
With auto-distribution enabled, the following will occur:
1012

1113
* upon publication, posts and pages will be pushed to all internal and external connections,

includes/auto-distribute.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
/**
1111
* Setup actions and filters.
1212
*
13+
* Runs on the `plugins_loaded, 20` hook.
14+
*
1315
* @since x.x.x
1416
*/
1517
function setup() {

includes/bootstrap.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,4 +237,6 @@ function() {
237237
\Distributor\DistributedPostUI\setup();
238238
\Distributor\Settings\setup();
239239
\Distributor\DebugInfo\setup();
240-
\Distributor\AutoDistribute\setup();
240+
241+
// Runs late to allow for site feature plugins to enable the feature.
242+
add_action( 'plugins_loaded', 'Distributor\\AutoDistribute\\setup', 20 );

0 commit comments

Comments
 (0)