Jump to content

Simple: open <a href="<php... in new window


eevan79

Recommended Posts

Well I didnt think of it til just now but you can do this with a plugin. Create a new file called comment-author-edit.php in the wp-content/plugins/ folder, and put the following in it

<?php

/*
Plugin Name: Edit Comment Author
Version: 0.1
Description: Automatically adds target="_blank" to comment author links
Author: Jay Gilford
Author URI: http://www.jaygilford.com/
Plugin URI: http://www.jaygilford.com/
*/

/* Version Check */
global $wp_version;

$exit_message = 'This plugin requires Wordpress 2.5 or newer. <a href="http://codex.wordpress.org/Upgrading_WordPress">Please Update!</a>';

if(version_compare($wp_version, '2.5', '<')) {
exit($exit_message);
}

/* FILTERS */
add_filter('get_comment_author_link', 'comment_author_link_edit');

function comment_author_link_edit($content) {
    $content = str_replace('<a ', '<a target="_blank"', $content);
    return $content;
}

Save it, then look for Edit Comment Author in your plugin menu in the dashboard, and enable it

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.