Skip to content

Instantly share code, notes, and snippets.

@clreed87
Last active February 12, 2018 03:30
Show Gist options
  • Save clreed87/afd7c7d10169e78fcecda1548f321327 to your computer and use it in GitHub Desktop.
Save clreed87/afd7c7d10169e78fcecda1548f321327 to your computer and use it in GitHub Desktop.
Do not trigger Jetpack Publicize if the post uses the 'status' post format
<?php
// Do not include the opening php tag.
//* Do not trigger Jetpack Publicize if the post uses the 'status' post format.
add_filter( 'publicize_should_publicize_published_post', 'crt_control_publicize', 10, 2 );
function crt_control_publicize( $should_publicize, $post ) {
// Return early if we don't have a post yet (it hasn't been saved as a draft)
if ( ! $post ) {
return $should_publicize;
}
// Return false is the format is 'status'
if ( has_post_format( 'status', $post->ID ) ) {
return false;
}
return $should_publicize;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment