Skip to content

Commit

Permalink
Merge pull request #56 from CodeProKid/CI-5582
Browse files Browse the repository at this point in the history
Prevents tasks from being synced by Jetpack
  • Loading branch information
jasonbahl authored Sep 4, 2018
2 parents 3bcd0ee + d7d08c9 commit 976efee
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/Register.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ public function setup() {
// Registers the "task" post type
add_action( 'init', [ $this, 'register_post_type' ] );

// Disable syncing in Jetpack
add_filter( 'option_jetpack_sync_settings_post_types_blacklist', [ $this, 'blacklist_post_type' ] );
add_filter( 'default_option_jetpack_sync_settings_post_types_blacklist', [ $this, 'blacklist_post_type' ] );

}

/**
Expand Down Expand Up @@ -116,4 +120,22 @@ public function register_post_type() {

}

/**
* Blacklists the wpqt-task post type from being synced in Jetpack
*
* @param array|false $post_types Either the false default or an existing array of blacklisted
* post types
*
* @return array
* @access public
*/
public function blacklist_post_type( $post_types ) {
if ( is_array( $post_types ) ) {
$post_types[] = 'wpqt-task';
} else {
$post_types = [ 'wpqt-task' ];
}
return $post_types;
}

}

0 comments on commit 976efee

Please sign in to comment.