When you register_taxonomy you can simply add an array of post_types to $object_type
parameter.
From WordPress-codex:
(array/string) (required) Name of the object type for the taxonomy
object. Object-types can be built-in objects (see below) or any custom
post type that may be registered.
So you can just add an array of post_types after you run register_taxonomy
and its name in this case “genre”.
See code below:
//hook into the init action and call create_book_taxonomies when it fires
add_action( 'init', 'create_book_taxonomies', 0 );
//create genres for the post_types post and page
function create_book_taxonomies() {
$labels = array(
'name' => _x( 'Genres', 'taxonomy general name' ),
'singular_name' => _x( 'Genre', 'taxonomy singular name' ),
'search_items' => __( 'Search Genres' ),
'all_items' => __( 'All Genres' ),
'parent_item' => __( 'Parent Genre' ),
'parent_item_colon' => __( 'Parent Genre:' ),
'edit_item' => __( 'Edit Genre' ),
'update_item' => __( 'Update Genre' ),
'add_new_item' => __( 'Add New Genre' ),
'new_item_name' => __( 'New Genre Name' ),
'menu_name' => __( 'Genre' ),
);
register_taxonomy(
'genre',
array('post', 'page'), // add your post_types here
array(
'hierarchical' => false,
'labels' => $labels,
'show_ui' => true,
'show_admin_column' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'genre' ),
));
}
Then you share the same data on dose post_types
.