Let each author at your WordPress website connect to their Bluesky account. When they publish a post, it is sent to their Bluesky account. (There is a 1 to 2+ minute delay depending on if a token is expired and/or something like the image upload fails at first.)
This plugin allows each WordPress author to connect their Bluesky account using their handle and password. It then automatically posts published posts to their Bluesky account.
Each author can connect their Bluesky account by using the provided shortcode [bsky_connect]. This renders a connection form for the author to connect or disconnect their Bluesky account.
When a post is published, the plugin schedules an auto-post to Bluesky with a delay of 1 minute using the wilcosky_bsky_schedule_auto_post function.
The wilcosky_bsky_auto_post function is triggered to perform the following steps:
- Check Post Status: Ensure the post is published and not already posted.
- Retrieve Post and User Meta: Get the post details and user meta information.
- Check Open Graph Data: Retrieve Open Graph data (title, description, and image) from the post link.
- Upload Image (if available): If an Open Graph image is found, upload it to Bluesky.
- Prepare Post Data: Prepare the data for posting, including text and embed (if image is uploaded).
- Post to Bluesky: Attempt to post the data to Bluesky.
- Token Handling: If the token is expired, the refresh token is used. If the refresh token is also expired, re-authentication is performed.
If the initial posting attempt fails:
- First Attempt: The plugin will try to post again after a short delay.
- Second Attempt: If the first retry fails, it will attempt again.
- Third Attempt: As a foolproof mechanism, a third attempt will be made.
Authors can view a log of their auto-post attempts, including any errors or successful posts, directly from the frontend.
Authors can disconnect their Bluesky account using the disconnect form rendered by the [bsky_connect] shortcode. This will remove all stored session tokens and credentials.
When the plugin is uninstalled, it will clean up all relevant data, including user metadata and post metadata, and clear any scheduled events related to auto-posting to Bluesky.
wp-bluesky-autopost-per-author.php: The main plugin file containing all the functionality.
- Upload the plugin files to the
/wp-content/plugins/wp-bluesky-autopost-per-authordirectory, or install the plugin through the WordPress plugins screen directly. - Activate the plugin through the 'Plugins' screen in WordPress.
- Add the
[bsky_connect]shortcode to a page or post where authors can connect their Bluesky accounts. - Important: Add the following line to your
wp-config.phpfile, replacing'randomkeyhere'with a long random key:define('WILCOSKY_BSKY_ENCRYPTION_KEY', 'randomkeyhere');
- Connecting Account: Authors can connect their Bluesky account via the
[bsky_connect]shortcode form. - Auto-Posting: The plugin automatically handles auto-posting when a post is published.
- Disconnecting Account: Authors can disconnect their Bluesky account via the
[bsky_connect]shortcode form. - Viewing Log: Authors can view the log of their auto-post attempts from the frontend.
This plugin is licensed under the GPL3 license.
For support, contact Billy Wilcosky.