-
AuthorPosts
-
February 14, 2019 at 1:33 am #1066708
Hello,
I was having some trouble finding a solution to this as the other post :
https://kriesi.at/support/topic/how-to-remove-the-author-link-in-posts/is slightly outdated.
Incase anyone needs to remove the url for security reasons (author name shows actual username aka “admin” or similar, which can allow bots to bruteforce passwords for accurate users)
The code you need to replace is now located on line 296.
Here is the code I input
echo '<span class="blog-author minor-meta">'.__('by','avia_framework')." "; echo '<span class="entry-author-link" >'; echo '<span class="vcard author"><span class="fn">'; // changed the_author_posts_link(); to the_author(); to remove author URL from blog posts for security reasons. the_author(); echo '</span></span>'; echo '</span>'; echo '</span>';
This does not need a reply by Development.
Thank you
February 15, 2019 at 4:57 am #1067270March 21, 2019 at 5:26 pm #1081486I’m curious why this isn’t done by default?
Assuming there is a good reason…
Is there any way of adding this change to child theme functions.php, and/or at least something more permanent, rather than having to manually change this after each theme update?
Thanks
March 21, 2019 at 6:33 pm #1081515Yes, EdgeWP, The question of why constantly recurring requests are not finally set as an option and every time here “support” is made, I ask myself again and again.
March 22, 2019 at 1:39 pm #1081822I guess I’m not questioning the removal of the permalink itself..
But, since NickName is a required field for every user.. and there I assume for both anonymity as well as security. (security being more my concern!)
I just don’t understand when the Display Name Publicity is set to use NickName…
Why on earth would the permalink reflect the actual User Name and not the NickName?
An afterthought of continued updates that was never considered or addressed maybe?
Not sure, but for now, I guess I’ll just add this as one more thing needed to be done after each theme update…
Unless someone might suggest an alternative, and/or more permanent solution?
March 24, 2019 at 8:00 pm #1082353Hi EdgeWP,
Wordpress websites were mainly for posts originally and so it is a normal thing to show the post author, of course, it’s not supposed to be an admin and sometimes it is important for SEO, so by default author is shown on posts built with the Advanced Layout Builder.
Best regards,
Victoria- This reply was modified 5 years, 8 months ago by Victoria.
July 1, 2021 at 7:10 pm #1308391Dear haydaw,
Thanks a lot for sharing the updated solution to this problem. Very helpful!Dear Enfold-team,
May I come back to the follow-up question EdgeWP already touched above.Is there a way to prevent the change in wp-content\themes\enfold\includes\loop-index.php from being overwritten by future theme updates?
I am already running a child theme. How can I replace a php-file in the includes-folder of the parent theme by a modified php-file located in the child theme folder? I guess it’s necessary to add some code to functions.php (similar to the activation of custom ALB shortcodes)?
Can you help with this?
Thanks and best,
Hagen
July 4, 2021 at 11:56 pm #1308686Hi,
Thank you for your patience, to add a modified\includes\loop-index.php
to your child theme simply add the directory and file to your child theme like this\wp-content\themes\enfold-child\includes\loop-index.php
no functions are needed. I tested this with v4.8.3
The correct line to modify in\includes\loop-index.php
is 443Best regards,
MikeJuly 8, 2021 at 4:54 pm #1309281Dear Mike,
I just found the time to test your solution. It works perfect! Thank you very much.
Another – probably stupid – question: My installation now uses the modified loop-index.php file located in the child theme. What happens if the original loop-index.php file is being modified with one of the upcoming updates? How will I notice? Will everything crash? :-)
Thanks again and best regards,
HagenJuly 9, 2021 at 12:49 pm #1309382Hi,
Glad that helped, any new function in the loop-index.php should work, only the currently named functions in your child theme would be overwritten. If one of those functions was changed you probably would not know until some new feature doesn’t work. Our Dev team is very careful about backward compatibility so I doubt you would have a crash but you could compare files before updating.
I recommend creating a staging site to test all updates before applying them to your live site, as a standard procedure.Best regards,
MikeJuly 15, 2021 at 6:20 pm #1310322Dear Mike,
Thanks a lot for your clear and precise response. I highly appreciate that.
Sorry to bother you with the following follow-up question: Is there a similar way to remove the category- and tag-URLs from the posts’ source code?
Thanks and best regards,
HagenJuly 17, 2021 at 2:44 pm #1310493Hi,
I didn’t find a similar solution but you could try adding this code to the end of your functions.php file in Appearance > Editor:function meta_custom_href_remove(){ ?> <script> (function($){ $(document).ready(function(){ $('.blog-tags.minor-meta a').contents().unwrap(); $('.blog-categories.minor-meta a').contents().unwrap(); }); })(jQuery); </script> <?php } add_action('wp_footer', 'meta_custom_href_remove');
Best regards,
MikeJuly 28, 2021 at 4:01 pm #1313056Hi Mike!
Thanks again.
Unfortunately, the code doesn’t seem to work on my end.
Please find the URL of an example page in the private content area. Although your funtion is executed when the page is loaded, the category-URL can still be found in line 287 of the source code and the tag-URL in line 500.
Do you have any idea why it didn’t work as intended?
Thanks and best regards,
HagenJuly 29, 2021 at 10:36 am #1313200Hi,
I guess I overlooked the importance of removing this from your “source code”, the script I posted removes the links from the DOM so that it is not visible to visitors or search engines.
To remove this completely from the source code look in your child theme\loop-index.php
and remove line 494:
and lines 338 – 344
please give this a try.Best regards,
MikeAugust 5, 2021 at 6:18 pm #1314704Dear Mike,
Thank you so much! That’s exactly what I was looking for. It works perfectly fine.
Btw, I think it would be good to put this information into the standard Enfold documentation. I could imagine that everyone who is keen on having a clean page in terms of SEO / crawling budget would be interested in this little modification.
Thanks again and best regards,
HagenAugust 6, 2021 at 10:43 am #1314802Hi,
Glad we were able to help, if you have any further questions please create a new thread and we will gladly try to help you. Thank you for using Enfold.Best regards,
Mike -
AuthorPosts
- The topic ‘How to remove author URL on blog posts for security reasons’ is closed to new replies.