Keep WordPress comment_agent and comment_user_IP empty with hooks

WordPress saves all kinds of information when someone leaves a comment on your blog/website. Two pieces of information I don’t need from someone who comments on an article are the IP-address of the author and the User Agent of the browser they used to place the comment. pre_comment_* hooks WordPress has pre_comment_* hooks which can …

How to change WordPress default Email From Name and From Address

WordPress sends by default an email from wordpress@domainname.com with WordPress as sender name. This can be adjusted easily via a filter. Change the From Address The filter will change the From address from wordpress@ to the value you specify. function new_mail_from( $from_email ) { $from_email = ‘myownemail@domainname.com’; return $from_email; } add_filter( ‘wp_mail_from’, ‘new_mail_from’ ); Change …

Improved code – Show related posts in WordPress without a plugin

A while ago I posted an article about showing related posts in WordPress without the use of a plugin. Recently I have found better code for this and I would like to share it with you <?php $tag_ids = wp_get_post_tags( $post->ID, array( ‘fields’ => ‘ids’ ) ); $args = array( ‘tag__in’ => $tag_ids, ‘post__not_in’ => …