Cross-posting from WordPress to Mastodon

I’ve finally got WordPress to Mastodon cross-posting working the way I want: automatically, whether I’m posting through the WordPress web interface or through a desktop or mobile client like MarsEdit or the WordPress mobile app, and with the format that I want:

Title: Excerpt (#tags)

Full post on Eclecticism: URL

I’d been using the Autopost to Mastodon plugin, which works great, and I can recommend it — as long as you only or primarily post using the WordPress web interface.

However, the plug-in is only triggered when publishing a post through the WordPress web interface. Any time I posted through a client, nothing went to Mastodon. So I either had to go into the web interface and manually trigger an update to the post with the “Send to Mastodon” option checked, or just skip out on using anything but the web interface at all, which I’m not a fan of (especially on mobile).

I’d asked the plug-in author, and they’ve said that this is just the way it is.

So I put out a call for help on Mastodon, and got some kind tips from Elephantidae, who pointed out the Share on Mastodon plugin. This looked promising, as its documentation specifically mentions being able to configure it to work with externally created posts. However, looking through the docs made it clear that most of this plugin’s configuration, including changing the format of the text it sends to Mastodon, is done through adding and tweaking PHP functions…and as with most of my coding knowledge, my PHP knowledge is roughly at the “I can usually get a vauge idea of what it’s doing when I read the code, but actually creating something is a whole different ballgame” territory. Plus, dumping PHP code into my theme’s files risks losing those changes the next time the theme files are updated.

Retaining the code through theme updates can be managed through creating a site-specific plugin, however — a handy trick which, somewhat amusingly, I’d never had exactly the right combination of “I want to do this” and “how do I do it” in the past to discover until now.

So, after a bit of fumbling around with the Share on Mastodon plugin documentation and figuring out the right PHP and WordPress function calls, here’s what I’ve ended up adding to my site-specific plugin:

/* Tweaks for the Share on Mastodon plugin */

/* Customize sharing text */

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

  $status = get_the_title( $post ) . ": " . get_the_excerpt( $post );

  if ( $tags ) {
    $status .= " (";

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

    $status = trim( $status );  
    $status .= ")";

  $status .= "\n\nFull post on Eclecticism: " . get_permalink( $post );
  return html_entity_decode( $status );
  return $status;
}, 10, 2 );

/* Share if sent through XML-RPC */

add_filter ('share_on_mastodon_enabled', '__return_true');

/* End Share on Mastodon tweaks */

And after a few tests to fine-tune everything, it all seems to work just the way I wanted. Success!

(Also, re-reading through this, I’ve realized that since I like to give the background of why and how I stumble my way through things, I end up writing posts that are basically a slightly geekier version of the “stop telling me about your childhood vacations to Europe and just post the damn recipe!” posts that are commonly mocked. And I don’t even have ad blocks all over my site! At least I’m not making you click through several slideshow pages of inane chatter before I get to the good stuff. My inane chatter is easy to scroll through.)

Mastodon RSS Tips

  1. Get an RSS feed for any user by appending .rss to the end of their profile URL. For example, my profile is, so the RSS feed of my posts is

  2. This also works for hashtag searches; handy for keeping an eye on hashtags (without worrying you’ll miss them in your feed). In my case, as our social media manager, I watch for mentions of Norwescon. Since that hashtag search URL is <your server>/tags/norwescon, the RSS feed is <your server>/tags/norwescon.rss. (I’ve also subscribed to feeds for norwescon45, nwc45, and philipkdickaward.)

The feeds-for-users tip I’ve seen going around, but I’d not seen this applied to hashtag searches, so I gave it a shot, and was happy to see it worked. Figured I’d put both in one post for those who might not have known either.

Of Mastodon, Culture Clashes, and BBSs

TL;DR: Avoiding Mastodon because you’ve heard it’s problematic makes as much sense as avoiding the internet because you’ve heard it’s problematic.


Back in the antediluvian times before the Internet existed — you know, when great beasts like dinosaurs and, um…mastodons…roamed the earth — there were these things called Bulletin Board Systems, or BBSs.

Each BBS was a single computer sitting in someone’s house, connected to a telephone line (the physical kind that came out of the wall). BBS users could use a modem (generally a little box with blinky lights that screamed at you when you started using it, but the really neat but slow early ones you’d actually place an telephone handset into) to place a telephone call from their computer to the BBS computer to see who had posted messages since the last time they called in, respond to those messages if they wanted, and upload or download tiny, low-resolution, 256-color .bmp images, often of impolite subject matter.

The really fancy BBS systems could connect to two or three phone lines at a single time, so that more than one user could log in at the same time. This would let them type back and forth at each other, much like a modern chat session, only they’d have to actually use real words, because this was also before emoji were invented.

Each BBS tended to have its own particular culture and rules. Some BBSs were regional for an area; others might have a Star Trek theme, or a Star Wars theme, or a Dr. Who theme. I think that was it, because those were the only approved geek interests at the time. People with particular interests would join BBSs that supported those interests, so they could have conversations with other people that shared those interests.

Eventually, BBS systems gained the ability to dial into each other and exchange messages. Suddenly conversations could involve not just the users on an individual BBS, but also users on other BBSs. Once a day or so, one BBS would call another one, send a bunch of replies to discussions that had been posted in the past day over, and receive a bunch of replies to discussions.

Of course, even when one Star Trek BBS was talking to another Star Trek BBS, they might not have exactly the same rules. Subjects that were fine one one server might be anathema on the other. Maybe a user who had gotten into a fight with someone on one server had started using another one, but now those two servers were talking to each other. Basically, people are people, and as every good Depecehe Mode listener knows, that doesn’t always work out.

But still, people generally like to meet and talk to other people about things they enjoy (not to mention exchange tiny, low-resolution, 256-color .bmp images of impolite subject matter), and so these differences were dealt with, and different servers found ways to get along. Or, if there were simply too many differences to overcome, the servers would simply stop calling each other to exchange messages.

Basically, we all either figured out how to get along, or if there was a known problem server, we just stopped dealing with it.

But we didn’t say that, “Oh, I heard BBSs were a problem, so I don’t do that.”

Well, okay, sure, I’m sure there were people who had that attitude. But the rest of us knew that you didn’t have to throw the BBS out with the bathwater (there’s a risk of electrical shock when doing that anyway) — all you had to do was ignore the BBS that was the problem, not ignore BBSs altogether.

Fast forward a few decades.

Now every computer talks to every other computer. Some of those computers host discussions from a number of different people. Some of those groups of people are perfectly pleasant, reasonable people, whose only concerns are ensuring that everyone they know has a lifetime supply of puppies, kittens, and rainbows. Some of those groups of people are…otherwise interested.

They all exist on the same internet, but they’re on different systems, using different software, much of which doesn’t easily talk to the other kinds of systems and software out there. So when you run across a part of the internet that has all the appeal of free diving into depths of the New York City sewer system, the easiest solution is to simply not explore that part of the internet. (And hopefully, you escape before attracting their notice, so they don’t follow you wherever you go.)

So we (most of us, at least) don’t avoid the entire internet because we know that there are some parts of it that are not places you’d want to wander through late ate night (or, sometimes, even in the broad light of day).

One of Twitter’s major problems is that it is a monolithic system: If you’re on Twitter, you’re in the same system as every other Twitter user. And because Twitter had dodgy and poorly enforced protocols and methods for protecting its users, there was no good way to say, “I don’t want to deal with this unpleasant group of Twitter users”. Everyone’s in the same room at the same party, and there’s no real way to escape short of leaving the party entirely, even if that means having to abandon all the partygoers that you like to get away from the partygoers with the funny little mustaches who are being jerks.

Mastodon, however, isn’t monolithic. It’s not a single system. This is where you start hearing the words “decentralized” and “federated” and your eyes glaze over, but all that means is, just like the BBSs of ye olden days, it’s a bunch of individual servers that can to talk to each other. The biggest difference is that where in the BBS days, BBS owners had to find each other and set up the connections intentionally (opt-in), Mastodon’s default is for servers to talk to each other unless they choose not to (opt-out).

Some servers are puppies and kittens and rainbows, some aren’t. But when the owner of the Mastodon server realizes that the users from keep harassing people, causing problems, and being generally unpleasant, they can just decide not to talk to that server anymore. Poof! Problem solved, no more sewer rats skittering around biting people.

So, is Mastodon a problem? No more than BBSs are a problem, or the Internet is a problem. Individual Mastodon instances may be, but they can be dealt with.

And, of course, nobody can spend $44 billion to run Mastodon into the ground in two weeks.