How to make comments url open in new window?

ByFuwei

How to make comments url open in new window? My students asked this question, if a message on wordpress, url within the commente opens in this window, it becomes cumbersome for the user to come back to this blog, so, would like to be able to open the url in the comments in a new window.

Today,A message was quoted onseo.tm,he leaves a comment and a urlin this article, how can I get those url to open in a new window?

I asked deepseek this question and he answered as follows:
Log in to your WordPress backend and go to “Appearance” > “Theme Editor”.

On the right hand side, select the functions.php file.

Add the following code at the end of the file:

function open_comments_links_in_new_window($text) {$text = str_replace('<a href=', '<a target=“_blank” href=', $text); }return $text;}add_filter('comment_text', 'open_comments_links_in_new_window');

Save changes.

I did what it suggested and it worked. Thanks!

If you also have this problem: How to make comments url open in new window, the above method and code can help you.

Similar Posts

How to de-index pages from google using robots.txt

How to de-index pages from google using robots.txt

ByFuwei

Today, I checked Google’s indexing of seo.tm and found that Google had misindexed some pages, which came about after I tested the WordPress plugin WooCommerce a few days ago. In order to give Google a better impression, I blocked these incorrect inclusions via robots.txt, hoping that Google would remove the inclusion of the page soon.

Leave a ReplyCancel reply

Your email address will not be published.Required fields are marked*