WP to Mastodon Auto Poster
Automatically posts to Mastodon when a WordPress post is published.
by Pavel Janíček · github.com/pavel-janicek/wordpress-to-mastodon-simple-post
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/pavel-janicek/wordpress-to-mastodon-simple-post/archive/refs/heads/main.zipReadme
WP to Mastodon Auto Poster
A lightweight WordPress plugin that automatically posts to Mastodon whenever a new post is published.
It sends the post title and permalink to your Mastodon account using the Mastodon API.
Features
- Automatically posts to Mastodon when a WordPress post is published
- Simple configuration via WordPress admin (no editing files)
- Stores Mastodon instance URL and access token in plugin settings
- No external libraries required
- Minimalistic and easy to modify
Installation
1. Upload the plugin
Create a new folder inside your WordPress installation:
wp-content/plugins/wp-to-mastodon-auto-poster/
Inside that folder, create the main plugin file:
wp-to-mastodon-auto-poster.php
Paste the plugin code into that file.
Alternatively, zip the folder and upload it via
WordPress Admin → Plugins → Add New → Upload Plugin.
Configuration
The plugin now includes a settings page in the WordPress admin.
1. Open the settings page
Go to:
Settings → Mastodon Auto Poster
2. Enter your Mastodon credentials
You will see two fields:
-
Mastodon instance URL
Example:https://mastodon.social -
Access token
A token with permissionwrite:statuses
How to get your Mastodon access token
- Log in to your Mastodon instance
- Go to Preferences → Development → New Application
- Create a new app with permission:
write:statuses
- Copy the Access Token
- Paste it into the plugin settings page
Activation
- Log in to your WordPress admin panel
- Go to Plugins → Installed Plugins
- Find WP to Mastodon Auto Poster
- Click Activate
How It Works
When a WordPress post is published:
- The plugin hooks into the
publish_postaction - It builds a message containing the post title and permalink
- It sends the message to your Mastodon instance via
/api/v1/statuses - If the request fails, an error is written to the WordPress debug log
Only standard posts (post post type) trigger the auto‑posting.
Troubleshooting
Nothing is posted to Mastodon
- Verify your access token is correct
- Ensure the token has the
write:statusespermission - Check that your Mastodon instance URL is valid
- Look at the WordPress debug log for error messages
Plugin activates but does nothing
- Make sure you are publishing a post, not a page or custom post type
- Confirm the plugin settings are filled in