4

I've noticed that Wordpress generates 2 links in header. They contain some oembed arguments.

This look like this:

<link rel="alternate" type="application/json+oembed" href="......">
<link rel="alternate" type="text/xml+oembed" href=".......">

{
      "version": "1.0",
      "provider_name": "Website Name",
      "provider_url": "http://example.com",
      "author_name": "admin",
      "author_url": "http://example.com/author/admin/",
      "title": "",
      "type": "rich",
      "width": 600,
      "height": 338,
      "html": "long string of html"
    }

I know I can disable those links but I would like to keep them and to remove only the author_name and author_url.

Is there a way I can do that?

I hope you can help.

Thank you.

Mikev
  • 2,012
  • 1
  • 15
  • 27
user4419473
  • 67
  • 1
  • 9

1 Answers1

5

Keep the rel links and filter the array data:

function filter_oembed_response_data_author( $data, $post, $width, $height ) {
    //print_r($data);
    unset($data['author_name']);
    unset($data['author_url']);
    return $data;
};
add_filter( 'oembed_response_data', 'filter_oembed_response_data_author', 10, 4 );

You can go to one of your rel link, uncomment print_r and manipolate the $data array to add, edit or remove entries.

Community
  • 1
  • 1
SuperGuest
  • 51
  • 1
  • 2