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
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://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/
And there's also these blog related topics:
https://docs.generatepress.com/article/generate_header_entry_meta_items/
https://docs.generatepress.com/article/option_generate_blog_settings/
https://docs.generatepress.com/article/blog-content-layout/
Would like to know what exactly to edit for the desired result, thanks.
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?
Any chance you can link us to the page in question?
You can use the private information field:
https://docs.generatepress.com/article/using-the-premium-support-forum/#private-information
Let me know :)
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.
Is there a specific page/post we should be looking at?
And can you show me a screenshot of exactly what you are referring to?
https://docs.generatepress.com/article/using-the-premium-support-forum/#uploading-screenshots
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' );
If not then this is the function you are looking for I believe:
https://github.com/tomusborne/generatepress/blob/4895a2e7595bb809075b375201fd735112f41570/inc/structure/post-meta.php#L216
It has a filter you can modify:
https://docs.generatepress.com/article/generate_post_author_output/
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!