Skip to content

Commit d7d08c9

Browse files
committed
Prevents tasks from being synced by Jetpack
1 parent 3bcd0ee commit d7d08c9

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/Register.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ public function setup() {
1717
// Registers the "task" post type
1818
add_action( 'init', [ $this, 'register_post_type' ] );
1919

20+
// Disable syncing in Jetpack
21+
add_filter( 'option_jetpack_sync_settings_post_types_blacklist', [ $this, 'blacklist_post_type' ] );
22+
add_filter( 'default_option_jetpack_sync_settings_post_types_blacklist', [ $this, 'blacklist_post_type' ] );
23+
2024
}
2125

2226
/**
@@ -116,4 +120,22 @@ public function register_post_type() {
116120

117121
}
118122

123+
/**
124+
* Blacklists the wpqt-task post type from being synced in Jetpack
125+
*
126+
* @param array|false $post_types Either the false default or an existing array of blacklisted
127+
* post types
128+
*
129+
* @return array
130+
* @access public
131+
*/
132+
public function blacklist_post_type( $post_types ) {
133+
if ( is_array( $post_types ) ) {
134+
$post_types[] = 'wpqt-task';
135+
} else {
136+
$post_types = [ 'wpqt-task' ];
137+
}
138+
return $post_types;
139+
}
140+
119141
}

0 commit comments

Comments
 (0)