{"id":311,"date":"2013-08-21T03:23:43","date_gmt":"2013-08-21T03:23:43","guid":{"rendered":"http:\/\/pixert.com\/blog\/?p=311"},"modified":"2013-09-02T15:26:04","modified_gmt":"2013-09-02T15:26:04","slug":"how-to-modify-get-comment-author-link-open-new-window","status":"publish","type":"post","link":"https:\/\/pixert.com\/blog\/how-to-modify-get-comment-author-link-open-new-window\/","title":{"rendered":"How to Modify get_comment_author_link to Open Comment Authors Website on new Window"},"content":{"rendered":"<p><a href=\"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2013\/08\/wordpress-logo-notext-rgb.jpg\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"319\" data-permalink=\"https:\/\/pixert.com\/blog\/how-to-modify-get-comment-author-link-open-new-window\/wordpress-logo-notext-rgb\/\" data-orig-file=\"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2013\/08\/wordpress-logo-notext-rgb.jpg?fit=250%2C250&amp;ssl=1\" data-orig-size=\"250,250\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;}\" data-image-title=\"wordpress-logo-notext-rgb\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2013\/08\/wordpress-logo-notext-rgb.jpg?fit=250%2C250&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2013\/08\/wordpress-logo-notext-rgb.jpg?fit=250%2C250&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2013\/08\/wordpress-logo-notext-rgb.jpg?resize=250%2C250\" alt=\"wordpress-logo-notext-rgb\" width=\"250\" height=\"250\" class=\"aligncenter size-full wp-image-319\" srcset=\"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2013\/08\/wordpress-logo-notext-rgb.jpg?w=250&amp;ssl=1 250w, https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2013\/08\/wordpress-logo-notext-rgb.jpg?resize=150%2C150&amp;ssl=1 150w\" sizes=\"auto, (max-width: 250px) 100vw, 250px\" \/><\/a>By default, get_comment_author_link &nbsp;redirects the user to the site which was entered by comment author when they wrote comment in same window of our site. What if we want this to open on new window?<\/p>\n<p>Add following code to functions.php in your live theme directory<\/p>\n<pre class=\"brush: php; title: Code Block; notranslate\" title=\"Code Block\">\r\n\/\/Display website on new window when readers click Commenter's name \r\nadd_filter( &quot;get_comment_author_link&quot;, &quot;pxzoom_modifiy_comment_author_anchor&quot; );\r\nfunction pxzoom_modifiy_comment_author_anchor( $author_link ){\r\n    return str_replace( &quot;&lt;a&quot;, &quot;&lt;a target='_blank'&quot;, $author_link );\r\n}\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>By default, get_comment_author_link &nbsp;redirects the user to the site which was entered by comment author when they wrote comment in same window of our site. What if we want this to open on new window? Add following code to functions.php in your live theme directory \/\/Display website on new window when readers click Commenter&#8217;s name [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":319,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[54,5],"tags":[55,6],"class_list":["post-311","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-code-snippet","category-wordpress","tag-code-snippet-2","tag-wordpress-2"],"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2013\/08\/wordpress-logo-notext-rgb.jpg?fit=250%2C250&ssl=1","jetpack_shortlink":"https:\/\/wp.me\/p1pvi1-51","jetpack-related-posts":[{"id":259,"url":"https:\/\/pixert.com\/blog\/flickr-badges-open-new-window-jquery-way\/","url_meta":{"origin":311,"position":0},"title":"Flickr Badges Open New Window jQuery way","author":"Pixel Insert \/ Pixert","date":"October 1, 2012","format":false,"excerpt":"I recently added a Flickr Badge to a site and really loved everything about it except that there was no way to have it open the photos in a new window when they were clicked Flickr badge looked like the following - Username [php] <div id=\"flickr_badge_wrapper\"> <script type=\"text\/javascript\" src=\"http:\/\/www.flickr.com\/badge_code_v2.gnecount=10&display=latest&size=s&layout=x&source=user&user=username\"><\/script><\/div> [\/php]\u2026","rel":"","context":"In &quot;Code Snippet&quot;","block_context":{"text":"Code Snippet","link":"https:\/\/pixert.com\/blog\/category\/code-snippet\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":396,"url":"https:\/\/pixert.com\/blog\/wordpress-comments-links-open-new-window\/","url_meta":{"origin":311,"position":1},"title":"WordPress comments links open in new window","author":"Pixel Insert \/ Pixert","date":"February 10, 2015","format":false,"excerpt":"We would like links in any comments open in new window instead of same window because we still want to read more in that page. WordPress comments links open in same window as default action, adding following code snippet could make these links open in new window instead, just add\u2026","rel":"","context":"In &quot;WordPress&quot;","block_context":{"text":"WordPress","link":"https:\/\/pixert.com\/blog\/category\/wordpress\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2015\/02\/commentslinksnewwindow.jpg?fit=808%2C650&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2015\/02\/commentslinksnewwindow.jpg?fit=808%2C650&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2015\/02\/commentslinksnewwindow.jpg?fit=808%2C650&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2015\/02\/commentslinksnewwindow.jpg?fit=808%2C650&ssl=1&resize=700%2C400 2x"},"classes":[]},{"id":134,"url":"https:\/\/pixert.com\/blog\/install-favicon-into-a-wordpress-website\/","url_meta":{"origin":311,"position":2},"title":"Install Favicon into a WordPress website","author":"Pixel Insert \/ Pixert","date":"August 22, 2011","format":false,"excerpt":"1. Upload favicon.ico to the theme directory, e.g wp-content\/themes\/twentyeleven 2. Open file header.php, add the following code between <head> and <\/head> [php]<link rel=\"shortcut icon\" href=\"<?php bloginfo('stylesheet_directory'); ?>\/favicon.ico\" \/>[\/php]","rel":"","context":"In &quot;Code Snippet&quot;","block_context":{"text":"Code Snippet","link":"https:\/\/pixert.com\/blog\/category\/code-snippet\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2011\/03\/wordpresslogo-300x68.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":277,"url":"https:\/\/pixert.com\/blog\/change-default-wordpress-logo-link-wordpressorg-to-your-domain-name\/","url_meta":{"origin":311,"position":3},"title":"Change Default WordPress Logo Link from wordpress.org to Your Domain Name","author":"Pixel Insert \/ Pixert","date":"January 1, 2013","format":false,"excerpt":"When you open WordPress login page, the default logo links to\u00a0WordPress.org. This is a quick tip for using your own link. Open the\u00a0functions.php\u00a0file. Then, add the following lines of code. And be sure to remember the PHP tag enclosure. [php]function wp_url_loginlogo(){ return \"http:\/\/yourdomain.com\/\"; \/\/ your URL here } add_filter('login_headerurl', 'wpc_url_loginlogo');[\/php]","rel":"","context":"In &quot;Code Snippet&quot;","block_context":{"text":"Code Snippet","link":"https:\/\/pixert.com\/blog\/category\/code-snippet\/"},"img":{"alt_text":"WordPress - the logo","src":"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2011\/03\/wordpresslogo-300x68.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":87,"url":"https:\/\/pixert.com\/blog\/share-wordpress-posts-or-pages-via-email-link\/","url_meta":{"origin":311,"position":4},"title":"Share WordPress Posts or Pages via Email link","author":"Pixel Insert \/ Pixert","date":"April 28, 2011","format":false,"excerpt":"A simple link that open users default email client to send that WordPress Post or Page as an email to a friend or colleague. It displays an excerpt in the email body [php] <a href=\"mailto:type email address here?subject=I wanted to share this post with you from <?php bloginfo('name'); ?>&body=<?php the_title('','',true);\u2026","rel":"","context":"In &quot;Code Snippet&quot;","block_context":{"text":"Code Snippet","link":"https:\/\/pixert.com\/blog\/category\/code-snippet\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":230,"url":"https:\/\/pixert.com\/blog\/disable-all-shortcodes-from-post-content\/","url_meta":{"origin":311,"position":5},"title":"WordPress: Disable All Shortcodes from the_content","author":"Pixel Insert \/ Pixert","date":"May 31, 2012","format":false,"excerpt":"The following code snippet will remove ALL shortcodes from the_content Add the following code snippet to the functions.php of your theme [php] function remove_shortcode_from_index($content) { $content = strip_shortcodes($content); return $content; } add_filter('the_content', 'remove_shortcode_from_index'); [\/php] You can disable shortcodes from particular page, e.g Home Page [php] function remove_shortcode_from_index($content) { if (\u2026","rel":"","context":"In &quot;Code Snippet&quot;","block_context":{"text":"Code Snippet","link":"https:\/\/pixert.com\/blog\/category\/code-snippet\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2011\/03\/wordpresslogo-300x68.png?resize=350%2C200","width":350,"height":200},"classes":[]}],"jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/posts\/311","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/comments?post=311"}],"version-history":[{"count":1,"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/posts\/311\/revisions"}],"predecessor-version":[{"id":801,"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/posts\/311\/revisions\/801"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/media\/319"}],"wp:attachment":[{"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/media?parent=311"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/categories?post=311"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/tags?post=311"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}