This looks interesting, a script to post from WordPress to Mastodon by Jan Boddez. I am not ready to post from WP as AP and have it be its own Mastodon account. I want to be able to post from WP into my existing Mastodon instance. This as I use Mastodon as a semi shielded channel and WP would for now be fully public. So will have to try this out.
I use Mastodon Autopost (github.com/simonfrey/mastodon_wordpress_autopost) for this. (I think originally came across it via Chris Aldrich). You can choose per post whether you want to post to your instance. I also added a couple of very hacky functions (github.com/ngm/semloop/blob/master/includes/syndication-targets.php) to add it as a Micropub syndication target.