Hi there,
Currently, the “Share when publishing” toggle is set to be on by default, and there isn’t an option to have it off by default.
Let’s look for some workarounds. How do you feel about manual sharing in those 5% of cases? Would that be a solution?
You could also use a code snippet to control the sharing per post category and exclude the default post category. If your default post category is uncategorized
this would look like so:
/**
* Do not trigger Publicize if the post uses the
uncategorized
category.
*
* @param bool $should_publicize Should the post be publicized? Default to true.
* @param WP_POST $post Current Post object.
*/
function jeherve_control_publicize_for_categories( $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 categories for our post.
$categories = get_the_category( $post->ID );
if ( is_array( $categories ) && ! empty( $categories ) ) {
foreach( $categories as $category ) {
if ( 'uncategorized' === $category->slug ) {
return false;
}
}
}
return $should_publicize;
}
add_filter( 'publicize_should_publicize_published_post', 'jeherve_control_publicize_for_categories', 10, 2 );
In the above snippet, you would need to replace uncategorized
by the slug of the default category in your blog.
Then you would always make sure that the default category is not used on the posts that should be shared.
(Note:?This is not a code recommendation. We are unable to provide support for customizations under our Scope or Support.)
I hope that the above points you in the right direction. Please let me know if you have further question.