Site logo

Archived topic

How to remove Author Tag from being visible in Discord's previews and others?

14 replies · Started by Enrique on November 7, 2022

Viewing posts 1–15 of 15

Hi there,

When linking my website in Discord I noticed that it shows an author tag. When trying to find a solution for hiding it I found these topics:

https://stackoverflow.com/questions/55018396/how-to-remove-author-tag-from-being-visible-in-discords-previews

https://wpdatatables.com/how-to-hide-the-author-in-wordpress/

But when trying to find the code in GeneratePress theme file editor, I don't seem to be able to locate it.

Is there a workaround for this within the GP premium theme?

Thanks in advance.

Hi there,

I don't believe that the GP has anything to do with this but let's check.

Does the code work if you activate a Twenty series WP theme to test?

Let me know :)

Yes, it works on those themes since they include the code to be modified at their theme .php files. The thing is, GP doesn't seem to include this "posted by" code so I could empty it as shown in the examples like this:

function twentynineteen_posted_by() {

}

endif;

Or I don't know in which GP theme file it's located.

I've found this old support topic:

https://generatepress.com/forums/topic/cannot-redeclare-function-generate_posted_on-error/

Seems to be a similar issue about trying to edit this type of theme functions.

Not sure if we could get the desired results with these type of functions from GP:

https://docs.generatepress.com/article/generate_post_date_output/#only-show-updated-date

These are author related ones:

https://docs.generatepress.com/article/generate_post_author_output/

https://docs.generatepress.com/article/generate_post_author/

My guess is that it should have to do with "generate_post_author_output". If it's the case, in which theme file is it located?

Sent.

Basically, what I need is that, when the link is sent to someone through the Discord app or any other app that gets similar tags from web pages, it doesn't show my admin username or any other author's name.

Image sent.

Sent another screenshot example showing how your website doesn't show any user tags.

We are not doing anything special on our site.

Can you try this PHP snippet:
add_filter( 'generate_post_author', '__return_false' );

Using the Code Snippets plugin, I was able to solve the issue by adding your PHP function. I have to say that at first, it didn't work but I understand that these changes take a little to show up, however, it all worked when I added another function related to the oEmbed filter.

I used the StackOverflow suggested code:

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;
}

And now the author tag is not showing in the Discord chatrooms.

Glad to hear.

Thanks for sharing!

This archived topic is closed to new replies.