janboddez / share-on-mastodon

Easily share WordPress posts on Mastodon.
https://jan.boddez.net/wordpress/share-on-mastodon
GNU General Public License v3.0
39 stars 5 forks source link

Show in REST API #30

Closed janboddez closed 2 years ago

janboddez commented 2 years ago

Like this, sort of.

public function register_meta() {
  $options = $this->options_handler->get_options();
  $post_types = $options['post_types'] ?? [];

  foreach ( $post_types as $post_type ) {
    register_post_meta( $post_type, '_share_on_mastodon_url', [
      'single'       => true,
      'show_in_rest' => true,
      'type'         => 'string',
    ] );
  }
}