I have closed commenting in this blog for the obvious spam & german law problems. But I still want ppl to be able to contact me.
So I want that people reading single entries can simply click on my name at the end of a post and write me a mail instead of going to the about me page and searching for my mail.
I was looking into the content-single.php
file. There is the line:
esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) )
that obviously needs to be changed for my needs. In the default config it redirects to a list of all the posts that the author has written. As a single-author-blog, it will do the same as clicking on the top left Link with the blog name.
According to the documentation of wordpress I shall use esc_url()
with the protocol name "mailto"
. Well, guess what! All the following do not work:
trying 4 was just for the laughs, bcs the protocols are defined in an array and mailto has the index 4. All of them give me urls like
esc_url( get_the_author_meta( 'user_email' ), 'mailto:' )
esc_url( get_the_author_meta( 'user_email' ), 'mailto' )
esc_url( get_the_author_meta( 'user_email' ), "mailto:" )
esc_url( get_the_author_meta( 'user_email' ), "mailto" )
esc_url( get_the_author_meta( 'user_email' ), 4 )
http://spammail@example.com
or even worse, throwing in some of the blog’s url. Looks like the second parameter is completely ignored!
So now I resorted to using this archaic construct:
'mailto:'.get_the_author_meta( 'user_email' )
This works for now, so most probably it just will stay that way. Is this broken or is it just me that could not figure out what I did wrong?