Skip to content

Share on Mastodon

Automatically share WordPress posts on Mastodon. You choose which Post Types are shared—though sharing can still be disabled on a per-post basis.


The plugin’s available from’s plugin repo, so you can just head into WP Admin > Plugins > Add New, search for share on mastodon, and install and activate from there.


Tell the Share on Mastodon settings page—visit Settings > Share on Mastodon—about your instance URL, and make sure to hit Save Changes. You’ll then be able authorize WordPress to post on your behalf.

Select the Post Types for which sharing to Mastodon should be possible, too. (Sharing can still be disabled on a per-post basis.)


When a Featured Image is set, Share on Mastodon will try to include it. Other media are not supported at the moment.

This behavior can be disabled using the share_on_mastodon_featured_image filter:


Currently, all toots sent via this plugin are public. Unlisted or followers-only toots may become an option later on.


This plugin now uses WordPress’ Meta Box API—supported by Gutenberg—to store per-post sharing settings, which makes it 100% compatible with the new block editor.


Share on Mastodon comes with a fair number of filters that allow tweaking its behavior.

Custom Formatting

By default, shared statuses look something like:

My Awesome Post Title

Mastodon is smart enough to then try and find things like an Open Graph image and description for that URL. There’s no need for a link shortener, either.

If you’d rather format toots differently, however, there’s a share_on_mastodon_status filter.

Example: If all posts you share are short, plain-text messages and you want them to appear exactly as written and without a backlink—and essentially create a WordPress front end to Mastodon—then the following couple lines of PHP would handle that.

add_filter( 'share_on_mastodon_status', function( $status, $post ) {
  $status = wp_strip_all_tags( $post->post_content );
  return $status;
}, 10, 2 );

Same example, but with a permalink at the end:

add_filter( 'share_on_mastodon_status', function( $status, $post ) {
$status = wp_strip_all_tags( $post->post_content );
$status .= "\n\n" . get_permalink( $post );
return $status;
}, 10, 2 );

We can even append WordPress tags as hashtags:

add_filter( 'share_on_mastodon_status', function( $status, $post ) {
  $tags = get_the_tags( $post->ID );

  if ( $tags ) {
    $status .= "\n\n";
    foreach ( $tags as $tag ) {
      $status .= '#' . preg_replace( '/\s/', '', $tag->name ) . ' ';

    $status = trim( $status );

  return $status;
}, 11, 2 );

Note: Most Mastodon instances will simply reject posts that are over 500 characters long. This WordPress plugin does currently not check this upfront, or warn you.

Tooting images can easily be disabled:

// Never upload featured images.
add_filter( 'share_on_mastodon_featured_image', '__return_false' );

If you wanted to disable images only for a certain post type, you could do so:

add_filter( 'share_on_mastodon_featured_image', function( $enabled, $post ) {
  if ( 'post' === $post->post_type ) {
    return false;

  return $enabled;
}, 10, 2 );

Share Programmatically Created Posts, and More

Even supported (per their Post Type) posts won’t be shared if not posted through WP Admin, as the “Share on Mastodon” checkbox value will not have been saved.

To work around this, e.g., for posts created through a third-party app, there’s a share_on_mastodon_enabled filter:

// Always share supported Post Types.
add_filter( 'share_on_mastodon_enabled', '__return_true' );

You could use the same filter to prevent, e.g., certain taxonomies from being shared.

add_filter( 'share_on_mastodon_enabled', function( $is_enabled, $post_id ) {
	if ( has_category( 'my-category-slug', $post_id ) ) {
		return false;

	return $is_enabled;
}, 10, 2 );


If you’ve added define('WP_DEBUG', true); to wp-config.php, the plugin settings page will show some debugging info. If debug logging is enabled as well, connection errors will be logged to WordPress’s default debug log (at whatever path and filename you’ve chosen for it).