Closed b4zz4 closed 4 years ago
If you wanted to automatically append tags (as hashtags) to a Mastodon status, you could do that as follows (add to your theme's functions.php
):
add_filter( 'share_on_mastodon_status', function( $status, $post ) {
$tags = get_the_tags( $post->ID );
if ( $tags ) {
$status .= PHP_EOL . PHP_EOL;
foreach ( $tags as $tag ) {
$status .= '#' . preg_replace( '/\s/', '', $tag->name ) . ' ';
}
$status = trim( $status );
}
return $status;
}, 10, 2 );
I might include something similar in the next version of the plugin.
Very good :D
This plugon take the tags of the publication and add it to the publication of mastodon