Work in progress

This site is currently undergoing an update. If you spot any problems on this page, please let me know.

Social posting from WordPress

Now that composer is shutting down, I’m looking at how to send posts to Facebook, Twitter, and maybe LinkedIn while keeping the original here on my WordPress site.

The most “official” option is JetPack from Automattic, the makers of WordPress. It’s easy to setup, but it doesn’t work perfectly on Twitter for my setup. I spent today trying options, including this plugin. The plugin is a bit complex to setup, but is super powerful. You need to pay for Google+ support though.

The only change I wanted to make to Jetpack was to use the post content as a title on Twitter, when there is no title. So if I post a status update with just a body, that should go to Twitter, not an empty title an a link to the blog post.

I started here. Turns out that approach doesn’t work. Or at least, after 4 hours of debugging, I couldn’t get it to work. No, in fact, I’m 90% sure it doesn’t work after I finally read the Jetpack code. Wow, what a time sink that turned out to be.

Finally, I got it running. I use the publicize_save_meta hook, check if we’re publishing to Twitter, and if we are, and there’s no post title, and no custom message already set, I set the custom message to the post body, trimmed.

https://gist.github.com/anonymous/0a336d294efd72dd886f22731b6cc40e

Posted on: February 11, 2017
Previous post: WordPress behind a reverse proxy
Next post: Click here

Categories

Comments

No comments on this post.