Automattic / Automattic/jetpack
sharing_meta_box_content meta box should only get added for post types sharing is enabled for
- Dominant language
- PHP
- Stars
- 1.8k
- Forks
- 898
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 774
Description
Currently, Sharedaddy does this:
``` php
function sharing_add_meta_box() {
$post_types = get_post_types( array( 'public' => true ) );
$title = apply_filters( 'sharing_meta_box_title', __( 'Sharing', 'jetpack' ) );
foreach( $post_types as $post_type ) {
add_meta_box( 'sharing_meta', $title, 'sharing_meta_box_content', $post_type, 'advanced', 'high' );
}
}
```
Shouldn't it be checking against the Sharing settings that enable sharing for specific post types only?
``` php
function sharing_add_meta_box() {
$post_types = get_post_types( array( 'public' => true ) );
$title = apply_filters( 'sharing_meta_box_title', __( 'Sharing', 'jetpack' ) );
$sharer = new Sharing_Service();
$global_options = $sharer->get_global_options();
foreach( $post_types as $post_type ) {
if ( ! in_array( $post_type, $global_options['show'] ) ) {
continue;
}
add_meta_box( 'sharing_meta', $title, 'sharing_meta_box_content', $post_type, 'advanced', 'high' );
}
}
```
Contributor guide
Research direction
Search for sharing_add_meta_box and inspect how Sharing_Service get_global_options() exposes enabled post types. Verify the meta box is registered only for post types included in the Sharing settings, and check the existing Sharing-related tests or WordPress admin behavior to confirm disabled types no longer receive it.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php, wordpress
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100