Far Out in the uncharted backwaters of the unfashionable end of the Western Spiral arm of the galaxy lies a small unregarded yellow sun.”
– Douglas Adams, The Hitchhikers Guide to the Galaxy

A little solar system, far away, insignificant and quite an odd place to be. That’s how one of my favorite books describes where we all live. I think, despite the current rise in users, Mastodon and the Fediverse still looks that way to many people.

My impression is, that’s true for a significant part of my favorite community as well. Chris Wiegman wrote a powerful text on why WordPress should embrace the Fediverse, so that is covered. I want to focus more on the “how” to migrate and not the “why”.

For everyone in the WordPress community, who is just one last step away from leaving the commercialized and in many ways poisoned corporate social networks behind. Here is my guide to find our little WordPress place on Mastodon in this huge collection of instances, blogs and applications we call the Fediverse.

Find an Instance

Mastodon is a decentralized network of instances (running the free Mastodon software) independently hosted, driven and funded by individuals with a wide range of intentions, goals and approaches. Seems familiar? Precisely! Working with WordPress or within the WordPress community, you should feel right at home. The WordPress blogging community and the Mastodon tooting community stand in many ways on the same grounds.

Take the same approach for finding an instance as for finding a blog you follow and ask yourself:

  • What is the instance about?
  • Who is running it?
  • What are the moderation rules?
  • Who else is here?

WordPress Mastodon Instances

If you want to consume a lot of WordPress content and/or intend to post some WordPress stuff yourself, a WordPress related instance might be a good choice. The chance that you find a like-minded community and meaningful discourse is good. I host the WordPress instance wptoots.social, welcome to join, but there are some other good choices:

  • wpbuilds.social (currently 47 active users) – hosted by Nathan Wrigley (@nathan@wpbuilds.social) maker of the WP Builds Podcast
  • dewp.space (currently 30 active users) – seems like a good choice if you feel at home in the German WordPress community
  • wp-social.net (currently 33 active users) – hosted by a WordPress hosting service
  • wptoots.social (currently 46 active users) – hosted by me
  • fosstodon.org (currently 26k active users) – if your interests are more about free software in general and you want a bigger instance
  • phpc.social (currently 2.1k active users) – if you see thing more from the PHP side

To make your decision, I recommend to start looking at the local timeline of an instance, if available without registration. That tells you what instance members have been up to. It shows also what you can expect regarding topics, post-frequency and tone of conversation. Take a look at the profile directory of each instance as well. And, of course, read the rules on the about page.

Many instances have more detailed community guides as well. These are interesting to learn more about how moderation works and what the instances members expect from you. For wptoots.social you find our guide at community.wptoots.social.

Moving to another instance

Some words about moving to another instance. Perhaps you started on a more general instance and want to move to a WordPress specific one. There is a documented process for moving, which works quite good. Moving works as follows:

  1. You keep your followers even on the new Instance
  2. You can export a list of people you follow and re-follow all of them easily from the new instance
  3. Old posts stay on your old instance
  4. After you have moved, the old account from you prior instance (don’t delete it) will redirect to the new account

All in all I think you can move without risks, especially if you haven’t that big of an account.

Find people to follow

You’ve chosen your Fediverse home! Now you have to find people to follow and build a following. That can be tricky, because of the decentralized nature of Mastodon. The search function on your instance is limited to the content your instance “knows” about. That means basically what you can find in the federated timeline, which includes:

  • Content and Users on your instance
  • Users and posts of all users your instances users are following
  • Relayed instances posts and users

So if you search for WordPress, be aware that the search doesn’t show anything about WordPress from the entire Fediverse.

The WordPress community on Mastodon

If you are looking for WordPress folks to follow, I’ve just the right thing for you. I’m curating a list of WordPress community members on Mastodon. Everyone on the list has at least one community badge on profiles.wordpress.org.

I’m always looking for new list members, there is a description on how to get onto the list on the website, sharing is appreciated.

Follow #Hastags

Additionally, another good way of keeping track of specific topics is following hashtags. First search for a hashtag on your instance (e.g. #wordpress). Then, follow by clicking the small follow icon to the right, above the hashtag content.

Find posts from Users on not connected Instances

Every now and then (actually more and more) someone shares a Mastodon post or user with me in a chat or something. Problem with that is, that following that link, directs me to the users instance (not my own). So boosting, following and liking doesn’t work directly, because I haven’t an account on that instance. However, clicking on the boost icon of a post, shows the following dialog:

Now, you only have to copy the “On a different server” input field and pasting the content to your instances (or apps) search field. Same works for following a user. Now you will see the post or user via your instance and can follow, boost, like and answer.

Find bots to fill your timeline with interesting things

If you are like me and use your social timeline as source for news, blog-posts etc, you might be interested in finding some bots, posting relevant content. Bots can be a really great source to automatically watch new content, but clearly they can be very annoying as well. On wptoots.social we run a WordPress bot, watching sources curated by the community on GitHub, which I think is a great addition to my timeline!

Engage with the community

Now, you know how to do things, you just have to start doing them! First step should be to setup a nice profile, you know the drill from every other social platform. Try to make it unique and that it says something about you. Write a short informative bio and use hashtags in it, to show your topics.

A nice way to make a statement and catch the eye of potential followers is an emoji in your nickname (where birdsites verification badge is). On WordPress related servers you might have a WordPress icon available. Here is an example on my profile:

Above you see that you even can use emojis in your bio, where we have a really special treat on wptoots.social. For every existing badge on profiles.wordpress.org we have a corresponding emoji. So I can integrate the icons from my WordPress profile page (and only them) in my Mastodon bio and show everyone what I stand for:

If you look for real verification (not a blue verification icon everyone can use), you might want to verify your blog or website, as you can see in my Mastodon profile above. There are quite a few manuals for doing that, and some plugins as well.

Join the WordPress Community on Mastodon and the Fediverse

Finishing our small journey through the Fediverse for WordPress folks, I can only say: Please join us, it’s incredibly fun. In one Mastodon month I have connected and talked with more WordPress people than in several birdsite years. Concluding with Douglas Adams, of course:

The chances of finding out what’s really going on in the universe are so remote, the only thing to do is hang the sense of it and keep yourself occupied.
– The Hitchhikers Guide to the Galaxy

 

Mastodon, a decentralized social media/microblogging platform, has become quite popular the last weeks and months. There are many good reasons to consider a Mastodon migration, but for Free Software enthusiast or WordPress lovers (like me), there are a even more specific reasons to give Mastodon a try. Hope you find my reasons compelling, even if I’m biased, running the WordPress centered Mastodon instance wptoots.social.

1. You can choose an Mastodon instance relevant to the topics you are most interested in

Mastodon is decentralized and there are thousands of instances to chose from. So pick a home to start your Mastodon journey carefully! If you are specifically interested in WordPress sign up on a WordPress centered instance and become a part of its WordPress centered community. You will instantly find people with the same interests!

Take even into account that little instances are more at risk of shutting down, while big instances can be hit by so many users, that they might get slow at times. You can move your user, including followers, to another instance at any time (your posts will be left on the “old” instance, though).

2. The local timeline

On mastodon you have three timelines. A home, local and federated timeline.

Mastodon timelines

Have you chosen an Mastodon instance, related to a topics of your interest, the local timeline might be the most interesting for you. Here you only see posts from users of your instance and, at least for the WordPress instances, they are right on topic the most time. The home and federated timelines are a broader look into what’s going on with the people you follow and the people your instance users follow.

3. Instance rules let you post, share and discuss in a safe environment

Every instance has its own rules, everyone signing up agrees to them, everyone violating them gets suspended (if moderators do their job, which they do in almost every case). So unlike many other platforms, you know what you’re signing up for and what you can expect. If you want to discuss WordPress professionally, you’ll just have to find an instance with a matching set of rules.

There is an argument that instances, and users choosing instances, can contribute to even stronger discourse- and opinion bubbles. I think it’s too early to say if that’s true. But my hope is, that there is a big difference: Between actively and consciously picking a community – and being influenced by an algorithm, making you believe the whole world thinks like you.

4. Your content is not monetized

Content you produce and thoughts that you share shouldn’t be monetized without your active approval and only with the methods you have agreed to. Period.

5. Your content is not ranked by an algorithm optimized for engagement

Engagement, likes, shares and clicks are the daily bread and butter of commercial social media platform. Of course their algorithms are optimized to encourage engagement and that is in many cases favoring polarized opinions and heated discussions.

They are not optimized, though, to favor more complex professional thoughts, balanced argumentation or input, broadening your professional point of view. But that’s what we can get on Mastodon with our WordPress postings.

6. Mastodon is built, owned, funded and driven by its community

The Mastodon Community is running Mastodon. It’s actually amazing that that’s working, if you think about it. But there are other examples, aren’t there? The WordPress project comes to mind and all the other FOSS projects! It would seem like there is no better fit for the WordPress Community than a Community-driven social network …

7. Mastodon is Free Software

You can’t argue that one, can you?

8. Mastodon can’t be bought

Another obvious one, but there is more to it. Even if Mastodon could be bought (and single instances surely can), every admin in the community decides independently when to upgrade. If you don’t like the direction Mastodon is taking, you can fork it and run an own version. There is great power in that: Nothing can be changed against the explicit approval of the community. Democracy by design. And guess which other community can’t be bought either? You guessed right.

9. Most communities on Mastodon are actually nice

That might be changing over time, but for now I think this is true: Big parts of the community are positive, inclusive, accepting and open. Most people migrating, are tired of the vibe of the big commercial platforms and working actively for a more constructive behavior on their new platform. And who knows? Maybe community-driven social networks are just nicer!

10. Meaningful exchange seems to be the rule not the exception on Mastodon

That’s more of an personal experience over the last weeks on my own instance. Everything I put out there (especially the WordPress and/or community relevant stuff) is followed by meaningful comments, some good discussions, cheering and sharing. I’ve really learned a lot and find the response from my social network on Mastodon to be quite uplifting and enlightening. Never felt that on the birdsite, to be honest.

Start your Mastodon migration

Convinced? Here are some starting points for your Mastodon migration:

Find an instance! If you search for the WordPress community you are welcome to wptoots.social. Or try one of the other WordPress instances (I know of) wpbuilds.social or wp-social.net. If you are not only into WordPress, a bigger instance like fosstodon.org might be the right thing for you.

Find your community! That is incredibly difficult in the beginning and motivated me to make a list. Everyone on it has at least one community badge on profiles.wordpress.org and has agreed to be listed.

Enjoy!

Share!

While I’m at it, I thought a Mastodon WordPress instance for community members, searching a home on Mastodon would be cool.

https://wptoots.social

Mastodon as decentralized social network seems like the perfect fit for a group as diverse and strong as the WordPress community. The instance should be able to handle a couple of hundred users, is actively maintained and has daily backup.

There is even a curated list of the WordPress Community on Mastodon.

And I promise: Instance will run indefinitely!

As a little extra you can add a WordPress batch in your Nickname (like Twitters verified icon) and show the entire fediverse what you stand for.

Hope for everyone loving WordPress out there to share and join! And follow me if you like:

@danielauener@wptoots.social

Current WordPress Rest API extension list

If you want to have all the endpoints as plugin, there is one in the plugin directory: WUXT Headless WordPress API Extensions

I love the WordPress Rest API and switching more and more from theme development to a headless WP approach, with an nice front-end framework. Right now I’m favoring Nuxt.js, which is build on Vue.js (check out wuxt, my very own dockerized nuxt/wp development environment).

For using WPs full strength with the Rest API I’ve collected/build a useful snippet library with WordPress Rest API extensions. I’ll try to maintain the following list as development goes on. All of the following extensions can be embedded in the functions.php file. If you wondering about the wuxt_ prefix, I’ve got the code from my Wuxt project and the prefix is as good as anyone.

Front-page extension

Everything starts with a nice front-page, but there no obvious way to get the WordPress front-page via the Rest API. To read the settings, you have to be authorized, which makes things unnecessary complicated. So here a custom endpoint for getting the front-page.

GET: /wp-json/wp/v2/front-page

<?php

/**
 * Adds a front-page endpoint for generell front-page settings in the
 * Front-end
 */
add_action( 'rest_api_init', 'wuxt_front_page_route' );


function wuxt_front_page_route() {
    register_rest_route( 'wp', '/v2/front-page', array(
        'methods'  => 'GET',
        'callback' => 'wuxt_get_front_page'
    ) );
}


function wuxt_get_front_page( $object ) {

    $request  = new WP_REST_Request( 'GET', '/wp/v2/posts' );

    $frontpage_id = get_option( 'page_on_front' );
    if ( $frontpage_id ) {
      $request  = new WP_REST_Request( 'GET', '/wp/v2/pages/' . $frontpage_id );
    }

    $response = rest_do_request( $request );
    if ($response->is_error()) {
        return new WP_Error( 'wuxt_request_error', __( 'Request Error' ), array( 'status' => 500 ) );
    }

    $embed = $object->get_param( '_embed' ) !== NULL;
    $data = rest_get_server()->response_to_data( $response, $embed );

    return $data;

}

?>

Right now, there is no way I know of for getting menus from the WordPress Rest API. I’m not sure if it’s the most effective way, but here my WordPress Rest API custom endpoint for menus. It registers even a standard ‘main’ menu as default if no location is requested.

Note: The most work for this snippet is done by the menu-class of Michael Cox, you have to include it to get the endpoint to work.

GET: /wp-json/wp/v2/menu?location=<location>

<?php

/**
 * Adds a menu endpoint
 */
require_once('/path/to/Menu.php');

add_action('init', 'wuxt_register_menu');
add_action('rest_api_init', 'wuxt_route_menu');

function wuxt_register_menu()
{
    register_nav_menu('main', __('Main meny'));
}

function wuxt_route_menu()
{
    register_rest_route('wp', '/v2/menu', array(
        'methods' => 'GET',
        'callback' => 'wuxt_get_menu',
    ));
}

function wuxt_get_menu($params)
{
    $params = $params->get_params();
    $theme_locations = get_nav_menu_locations();

    if (!isset($params['location'])) {
        $params['location'] = 'main';
    }

    if ( ! isset( $theme_locations[$params['location']] ) ) {
        return new WP_Error( 'wuxt_menu_error', __( 'Menu location does not exist' ), array( 'status' => 404 ) );
    }

    $menu_obj = get_term( $theme_locations[$params['location']], 'nav_menu' );
    $menu_name = $menu_obj->name;
    $menu = new Menu( $menu_name );
    return $menu->getTree();
}

?>

Filtering Categories and taxonomies

When filtering taxonomies with an Rest API request, you are stuck with OR-queries, because the category endpoint doesn’t give you the full complexity of a tax_query. That means you can get posts which are either in category A or B. The following adjustment doesn’t give you the full complexity either, but it lets you switch all tax_queries to an AND-relation, so that you can select posts which are both in category A and B.

GET: /wp-json/wp/v2/posts/?categories=1,2&and=true

<?php

  /**
   * Ads AND relation on rest category filter queries
   */
  add_action( 'pre_get_posts', 'wuxt_override_relation' );

  function wuxt_override_relation( $query ) {

    // bail early when not a rest request
  	if ( ! defined( 'REST_REQUEST' ) || ! REST_REQUEST ) {
  		return;
  	}

    // check if we want to force an "and" relation
    if ( ! isset( $_GET['and'] ) || !$_GET['and'] || 'false' === $_GET['and'] || !is_array( $tax_query = $query->get( 'tax_query' ) ) ) {
  		return;
  	}

    foreach ( $tax_query as $index => $tax ) {
      $tax_query[$index]['operator'] = 'AND';
    }

  	$query->set( 'tax_query', $tax_query );

  }

?>

Loading ACF Meta-fields

Integrating meta-fields from the Advanced-Custom-Fields plugin into the Rest API responses can be done with this plugin. If you need a simpler solution (only integrating meta fields into post-objects, not writing them), or simply a bit more control, the following snippet can get you started. It sets all ACF-fields to show_in_rest, which lets them appear in the post-objects meta-section:

<?php

    /**
     * Register meta fields from ACF
     */
    add_action( 'init', 'wuxt_register_acf_meta' );

    function wuxt_register_acf_meta() {

        if( function_exists( 'acf_get_field_groups' ) ){
            $result = array();
            $acf_field_groups = acf_get_field_groups();
            foreach( $acf_field_groups as $acf_field_group) {
                foreach($acf_field_group['location'] as $group_locations) {
                    foreach($group_locations as $rule) {
                        foreach(acf_get_fields( $acf_field_group ) as $field) {
                            register_meta( 'post', $field['name'], array( 'show_in_rest' => true ) );
                        }
                    }

                }

            }
        }

    }

?>

SEO-Data

The register_meta trick is handy, even for other plugins. If you want to integrate data from our favorite SEO add-on, Yoast WordPress SEO, into the post objects, you can do it like that:

<?php

    /**
     * Register meta fields for WordPress SEO
     */
    add_action( 'init', 'wuxt_register_yoast_meta' );

    function wuxt_register_yoast_meta() {
      if(in_array('wordpress-seo/wp-seo.php', apply_filters('active_plugins', get_option('active_plugins')))){

          $allowed_yoast_keywords = array(
              '_yoast_wpseo_title',
              '_yoast_wpseo_bctitle',
              '_yoast_wpseo_metadesc',
              '_yoast_wpseo_focuskw',
              '_yoast_wpseo_meta-robots-noindex',
              '_yoast_wpseo_meta-robots-nofollow',
              '_yoast_wpseo_meta-robots-adv',
              '_yoast_wpseo_canonical',
              '_yoast_wpseo_redirect',
              '_yoast_wpseo_opengraph-description',
          );

          foreach( $allowed_yoast_keywords as $field) {
              register_meta( 'post', $field, array( 'show_in_rest' => true ) );
          }

      }
    }

?>

Building Urls

If you are building a front-end app on top of WordPress, you have to think about how to structure your urls. WordPress has two default post-types (posts & pages) and in the urls is not distinguished which type you are requesting, so http://wp-site.expl/something might lead to a page or a post, dependent on the type of the object with the slug something.

That means, that if you want to mirror that behaviour in your app, you have to do two requests for each url, one searching pages, one searching posts. To make that one request, use the following.

GET: /wp-json/wp/v2/slug/<post-or-page-slug>

<?php

/**
 * Adds a slug endpoint for getting the page or post for a given slug
 */
add_action('rest_api_init', 'wuxt_slug_route');


function wuxt_slug_route()
{
    register_rest_route('wp', '/v2/slug/(?P<slug>\S+)', array(
        'methods'  => 'GET',
        'callback' => 'wuxt_get_slug'
    ));
}


function wuxt_get_slug($object)
{

    $slug = $object->get_param('slug');

    $request = new WP_REST_Request('GET', '/wp/v2/posts');
    $request->set_param('slug', $slug);

    $response = rest_do_request($request);

    if (!$response->data) {

        $request = new WP_REST_Request('GET', '/wp/v2/pages');
        $request->set_param('slug', $slug);

        $response = rest_do_request($request);
    }

    if (!$response->data) {
        return new WP_Error('wuxt_no_such_slug', __('Slug does not exist'), array('status' => 404));
    }

    $embed = $object->get_param('_embed') !== NULL;
    $data = rest_get_server()->response_to_data($response, $embed);

    return $data[0];
}

?>

More to come …

Hope you found something of the code above useful. Send me your extensions in the comments and I will happily integrate them!