• Hello,

    I have noticed the plugin does not send the letter avatar through the REST API. Is there anyway an option can be added to select to update that avatar too?

    Thank you

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter therealgilles

    (@chamois_blanc)

    I’m thinking the plugin should be using the get_avatar_url filter instead of get_avatar.

    Thread Starter therealgilles

    (@chamois_blanc)

    I added the following code to fix the avatar url sent through the REST API:

    add_filter('get_avatar_url', 'my_get_avatar_url', 10, 3);
    function my_get_avatar_url($url, $id_or_email, $args) {
      global $wp_first_letter_avatar;
    
      if (method_exists($wp_first_letter_avatar, 'set_comment_avatar')) {
        $avatar_output = $wp_first_letter_avatar->set_comment_avatar('', $id_or_email, $args['size'], $args['default'], $args['alt'], $args);
    
        if (preg_match('/src=\'([^\']+)\'/', $avatar_output, $matches)) {
          return $matches[1];
        }
      }
    
      return $url;
    }
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Plugin does not send letter avatar through REST API’ is closed to new replies.