mirror of
https://gh.wpcy.net/https://github.com/mainwp/Code-Snippets-Functions.git
synced 2026-05-04 12:22:24 +08:00
19 lines
644 B
Text
19 lines
644 B
Text
function jeherve_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;
|
|
}
|
|
|
|
// Get list of tags for our post.
|
|
$tags = wp_get_post_tags( $post->ID );
|
|
|
|
// Loop though all tags, and return false if the tag's name is `private`
|
|
foreach ( $tags as $tag ) {
|
|
if ( 'private' == $tag->name ) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
return $should_publicize;
|
|
}
|
|
add_filter( 'publicize_should_publicize_published_post', 'jeherve_control_publicize', 10, 2 );
|