Automattic / Automattic/jetpack
Publicize: Add Global Option To Remove Publicize For Custom Post Types (WooCommerce Products)
- Dominant language
- PHP
- Stars
- 1.8k
- Forks
- 898
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 774
Description
#### The Issue
Currently, Publicize is enabled for WooCommerce products (and all post types for that matter) by default. Not all WooCommerce customers like their products being shared to Social Media when they add these products in their site. While it is possible to limit the use of the publicize feature on a per-product basis, it would be super-convenient for customers, if publicize could be restricted in a post-type basis (as in the case with WooCommerce Products).
#### Steps to reproduce the issue
1. Install JetPack with Publicize enabled in a WooCommerce store with products.
2. Try adding a new product to the WooCommerce store.
3. You will notice that the product gets shared immediately on the Social Media profiles that are enabled.
#### Workaround
Currently, the only way to limit post type support on a per-post-type basis, would be to call the `remove_post_type_support` function, in the `init` hook. For instance - this snippet removes WooCommerce products from publicize:
```
add_action('init', 'woo_publicize_remove');
function woo_publicize_remove() {
remove_post_type_support( 'product', 'publicize' );
}
```
It would be a lot easier for customers if this feature was built-in, so that they won't have to use code snippets for the same.
Thanks!
Contributor guide
Research direction
Start by tracing Jetpack Publicize's handling of post-type support and the WordPress init hook, using the remove_post_type_support('product', 'publicize') workaround as the entry point. Done means customers can globally restrict Publicize for selected custom post types such as WooCommerce products without requiring a code snippet.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php, wordpress
- Domain
- backend, content
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100