Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 192 Vote(s) - 3.47 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to remove Author Tag from being visible in Discord's previews?

#1
When sharing a post to Discord, the preview Discord generates shows the author name and URL. We removed all information about the author but it didn't stop the author tag from showing.

![Image here][1]

[1]:
Reply

#2
@hrak has the right idea but his answer lacks context for those of us not used to dealing with PHP.

What I ended up doing was check if there was already a filter for `'oembed_response_data'` in **/wp-includes/default-filters.php**. Mine looked like this:

add_filter( 'oembed_response_data', 'get_oembed_response_data_rich', 10, 4 );

Add the previous line to the specified file if, for whatever reason, it isn't there already.

Afterward, I checked in **wp-includes/embed.php** for the `get_oembed_response_data_rich` function, which looked like this:

function get_oembed_response_data_rich( $data, $post, $width, $height ) {
$data['width'] = absint( $width );
$data['height'] = absint( $height );
$data['type'] = 'rich';
$data['html'] = get_post_embed_html( $width, $height, $post );

// Add post thumbnail to response if available.
$thumbnail_id = false;

if ( has_post_thumbnail( $post->ID ) ) {
$thumbnail_id = get_post_thumbnail_id( $post->ID );
}

if ( 'attachment' === get_post_type( $post ) ) {
if ( wp_attachment_is_image( $post ) ) {
$thumbnail_id = $post->ID;
} elseif ( wp_attachment_is( 'video', $post ) ) {
$thumbnail_id = get_post_thumbnail_id( $post );
$data['type'] = 'video';
}
}

if ( $thumbnail_id ) {
list( $thumbnail_url, $thumbnail_width, $thumbnail_height ) = wp_get_attachment_image_src( $thumbnail_id, array( $width, 99999 ) );
$data['thumbnail_url'] = $thumbnail_url;
$data['thumbnail_width'] = $thumbnail_width;
$data['thumbnail_height'] = $thumbnail_height;
}

return $data;
}

I just added the two lines of code that @hrak introduced in his answer to remove the author tag (name and URL) from `$data` before it was returned:

function get_oembed_response_data_rich( $data, $post, $width, $height ) {

(...)

if ( $thumbnail_id ) {
list( $thumbnail_url, $thumbnail_width, $thumbnail_height ) = wp_get_attachment_image_src( $thumbnail_id, array( $width, 99999 ) );
$data['thumbnail_url'] = $thumbnail_url;
$data['thumbnail_width'] = $thumbnail_width;
$data['thumbnail_height'] = $thumbnail_height;
}

unset($data['author_url']);
unset($data['author_name']);

return $data;
}

As before, add the `get_oembed_response_data_rich` function if it does not already exist. After about 5-10 minutes, Discord link embeds stopped showing the author tag.

Source:

-

[To see links please register here]

-

[To see links please register here]

Reply

#3
That’s done via oEmbed. Add below code in your functions.php file

add_filter( 'oembed_response_data', 'disable_embeds_filter_oembed_response_data_' );
function disable_embeds_filter_oembed_response_data_( $data ) {
unset($data['author_url']);
unset($data['author_name']);
return $data;
}


**disorc may have stored the response in cache so create new post or page and test that **


Reply

#4
I've done this by emptying the posted_by function like this article shows, in the "Use Code to Remove the Author Name" section

[To see links please register here]


basically find the `posted_by` function and empty it

```
function twentynineteen_posted_by() {

}

endif;
```
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through