Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
WP Plugins
Cron-Control
Commits
6988da3b
Commit
6988da3b
authored
Feb 09, 2017
by
Erick Hitter
Committed by
GitHub
Feb 09, 2017
Browse files
Merge pull request #87 from Automattic/fix/86
Filter Jetpack Sync post-type blacklist to ensure plugin is always excluded
parents
dba6362b
b7ebd39e
Changes
1
Hide whitespace changes
Inline
Side-by-side
includes/class-cron-options-cpt.php
View file @
6988da3b
...
...
@@ -29,6 +29,10 @@ class Cron_Options_CPT extends Singleton {
// Data storage
add_action
(
'init'
,
array
(
$this
,
'register_post_type'
)
);
// Prevent Jetpack from syncing plugin's CPT entries
add_filter
(
'option_jetpack_sync_settings_post_types_blacklist'
,
array
(
$this
,
'exclude_from_jetpack_sync'
),
999
);
add_filter
(
'default_option_jetpack_sync_settings_post_types_blacklist'
,
array
(
$this
,
'exclude_from_jetpack_sync'
),
999
);
// Lock for post insertion, to guard against endless event creation when `wp_next_scheduled()` is misused
Lock
::
prime_lock
(
self
::
LOCK
);
...
...
@@ -58,6 +62,23 @@ class Cron_Options_CPT extends Singleton {
}
}
/**
* Block Jetpack Sync from capturing plugin's data
*
* Data changes frequently and is of no value in any remote context
*/
public
function
exclude_from_jetpack_sync
(
$option_value
)
{
if
(
!
is_array
(
$option_value
)
)
{
$option_value
=
array
();
}
if
(
!
in_array
(
self
::
POST_TYPE
,
$option_value
)
)
{
$option_value
[]
=
self
::
POST_TYPE
;
}
return
$option_value
;
}
/**
* PLUGIN FUNCTIONALITY
*/
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment