Mass unlinking in Wordpress
- June 6th, 2009
- Posted in Featured . Tutorials
- Write comment or click if you like the post:
So yeah, nofollow doesn’t work like it used to. Your only options if you care about PR leaks are to either remove the links or to just ignore it. I’ll show you how you can unlink all external links on your WP blog using a regex and John Godley’s Search Unleashed plugin.
First, you want to prevent new urls from being posted. You’ll need to do a couple of theme edits.
Remove Comment Links in Wordpress:
Edit Theme > comments.php ; Remove the url form:
<div class="form-label"><label for="url">< ?php _e('Website', 'sandbox') ?></label></div>
<div class="form-input"><input id="url" name="url" type="text" value="<?php echo $comment_author_url ?/>" maxlength="50" tabindex="5" /></div>Use search regex plugin to remove the link:
http://wordpress.org/extend/plugins/search-regex/
To remove all commentluv links from comments:
(.*last blog post.*)
Remove all http links:
(http.*)
Remove only the link:
(<a href.*">) (</a>)
Unlink “a class” links:
(<a class.*">(.*?)</a>)
replace with $1
Unlink “a href” links with their url target as quoted plaintext (without killing image links):
(<a \s+(?:(?:\w+\s*=\s*)(?:\w+|"[^"]*"|'[^']*'))*?\s*href\s*=\s*(?<url>\w+|"[^"]*"|'[^']*')(?:(?:\s+\w+\s*=\s*)(?:\w+|"[^"]*"|'[^']*'))*?>[^< ]+</a>) </a>
replace with $1
Unlink everything including images:
(<a [\s]+[^>]*?href[\s]?=[\s\"']*(.*?)[\"']*.*?>([^< ]+|.*?)?<\/a>) </a>
replace with $2
No comments yet.