You are currently browsing the archives for the WordPress Tips category.

How to remove WPStart top navigation menu

Solution provided by Łukasz Kruszewski-Zelman at http://www.krusze.pl

How to remove WPStart top navigation menu

In functions.php – line 230
Change from: add_action( ‘wpstart_after_header’, ‘wpstart_nav’, 10);

to: remove_action( ‘wpstart_after_header’, ‘wpstart_nav’, 10);

 

Categories: WordPress TipsBookmark

Remove Spammers link from wordpress Comments

Are you tired of moderating, removing or editing the URLs of people who post comments in your wordpress blog? Are you sick of all the comment spammers who post those cookie cutter comments using scripts in your blog just to post links in your blog via the comment links to comment authors site? Well I was! And that is  when I decided that I would hack the wordpress code a little bit to totally disable linking to commenters site from the comments posted in the blog. 

The link to commenters site does serve some good purposes like letting the comment poster link to his/her blog/site which might have good resources and also allows free publicity and exchange of traffic between genuine blogs and sites via the comment links, but there is way too much nuisance and problems which weigh down these advantages.

Well this is what you need to do if you want to remove these links. Go to the wp-includes directory in your wordpress installation via ftp, locate a file called comment-template.php (in older versions of wordpress you would need to find comment-functions.php) , download the file, create a backup of the file to make sure you can upload a working copy in case you mess up.

Open the php file with notepad (any text editor) or any code editing software you may have. Now in the file at around line 106 you would locate a function called get_comment_author_link() (around line 347 if you are editing comment-functions.php) . The line number might vary from wordpress versions, but the code within the function is the same for all versions of wordpress after 1.5, so this hack will work for all versions of wordpress 1.5 and up. Within the function you would see the following lines

$url    = get_comment_author_url();
$author = get_comment_author();
if ( empty( $url ) || 'http://' == $url )
   $return = $author;
else
   $return = "<a href='$url' rel='external nofollow'>$author</a>";
   return apply_filters('get_comment_author_link', $return);

What this function does is, check if the comment author posted a URL when he/she posted a comment, if there is no url it just prints the author name, if there is an URL with the comment then wordpress prints the author’s name as a link to the authors website. We are going to modify the function to just print the authors name (without a link) even if a URL is present with the comment. For that just replace

$return = "<a href='$url' rel='external nofollow'>$author</a>";

With

$return = $author;

And you are done! Just save the file, upload the file back into the server and you should get comments with links removed with just the authors name throughout the website!

Next I am going to try to totally remove the URL field while posting comments into the blog to save the hassle of commenters entering a URL. Will get back with a quick guide for that when I succeed.

Categories: WordPress TipsBookmark