Sync Avatar from Discourse to Wordpress automatically

Away from computer at the moment but here’s the steps I took, you should be able to do it if you read about the various things I used:

  1. Create a Discourse webhook that posts to a PHP file in your plugin/theme any time someone updates their profile
  2. On the PHP page, get the payload which includes the User ID. Get the avatar URL from that, and save it as a custom meta field against the user in WordPress
  3. Update the code in WordPress that returns a user avatar with a function that instead returns that meta field

That’s it!