Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@lordmatt
Created December 27, 2022 04:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lordmatt/73f42861de7f061825919157c1673597 to your computer and use it in GitHub Desktop.
Save lordmatt/73f42861de7f061825919157c1673597 to your computer and use it in GitHub Desktop.
<?php
/*
Plugin Name: Lord Matt embeds Mastodon
Plugin URI: https://lordmatt.co.uk/projects/lord-matt-embeds-all-of-mastodon-project/
Description: An attempt to embed Mastodon on WordPress.
Version: 1.0.0
Author: @lordmatt@mastodon.social
Author URI: https://lordmatt.co.uk/
License: GPLv2 or later
Text Domain: lordmatt_embeds_mastodon
*/
// Register oEmbed providers
function lordmatt_embeds_mastodon() {
$instances = array(
'mastodon.social','mastodonapp.uk','securitymastod.one','mastodon.nuzgo.net','mstdn.party',
'linuxrocks.online','animalliberation.social','fern.surgeplay.com','mastodon.club',
'mastodon.irish','mastodon.ninetailed.uk','mastodon.top','meow.social','writing.exchange',
'convo.casa','mastodon.cloud','indieweb.social','phpc.social','mstdn.social','mastodon.world',
'dmv.community','mas.to','hachyderm.io','tabletop.social','fosstodon.org','toot.cafe',
'activism.openworlds.info','kolektiva.social','cryptotalks.social','aus.social',
);
foreach($instances as $instance){
wp_oembed_add_provider( 'https://'.$instance.'/*', 'https://'.$instance.'/api/oembed', false );
}
}
add_action( 'init', 'lordmatt_embeds_mastodon' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment