So that tag cloud seems to be a regular tag cloud generated by an AJAX request. This box appears to be the only place a tagcloud is generated via AJAX, so we can use that knowledge to use the get_terms
filter to filter any term queries performed in that AJAX request.
function wpse_277075_filter_tag_cloud( $terms, $taxonomies, $args, $term_query ) {
if ( is_admin() && isset( $_POST['action'] ) && $_POST['action'] === 'get-tagcloud' ) {
$args['meta_query'] = array(
array(
'key' => 'author',
'value' => get_current_user_id(),
)
);
$terms = $term_query->query( $args );
return $terms;
}
return $terms;
}
add_filter( 'get_terms', 'wpse_277075_filter_tag_cloud', 10, 4 );
Inside the get_terms
filter callback, I’ve checked for the $_POST['action']
variable because this will tell us if we’re in the AJAX request. Then we re-perform the tag query, but this time with a meta_query
filtering the results.
Note: This code assumes that the author is set via a meta_key
of author
which is set to a user ID.