{"id":396,"date":"2015-02-10T04:18:53","date_gmt":"2015-02-10T04:18:53","guid":{"rendered":"http:\/\/pixert.com\/blog\/?p=396"},"modified":"2015-02-10T04:22:19","modified_gmt":"2015-02-10T04:22:19","slug":"wordpress-comments-links-open-new-window","status":"publish","type":"post","link":"https:\/\/pixert.com\/blog\/wordpress-comments-links-open-new-window\/","title":{"rendered":"WordPress comments links open in new window"},"content":{"rendered":"<p><a href=\"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2015\/02\/commentslinksnewwindow.jpg\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"429\" data-permalink=\"https:\/\/pixert.com\/blog\/wordpress-comments-links-open-new-window\/commentslinksnewwindow\/\" data-orig-file=\"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2015\/02\/commentslinksnewwindow.jpg?fit=808%2C650&amp;ssl=1\" data-orig-size=\"808,650\" 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;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"commentslinksnewwindow\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2015\/02\/commentslinksnewwindow.jpg?fit=300%2C241&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2015\/02\/commentslinksnewwindow.jpg?fit=808%2C650&amp;ssl=1\" class=\"alignright size-medium wp-image-429\" src=\"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2015\/02\/commentslinksnewwindow-300x241.jpg?resize=300%2C241\" alt=\"commentslinksnewwindow\" width=\"300\" height=\"241\" srcset=\"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2015\/02\/commentslinksnewwindow.jpg?resize=300%2C241&amp;ssl=1 300w, https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2015\/02\/commentslinksnewwindow.jpg?w=808&amp;ssl=1 808w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a>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. <!--more-->WordPress comments links open in same window as default action, <strong>adding following code snippet could make these links open in new window instead, just add the code into functions.php of your WordPress theme<\/strong>. That&#8217;s it.<\/p>\n<pre class=\"brush: plain; title: Code Block; notranslate\" title=\"Code Block\">\r\n\r\nfunction comment_links_in_new_tab($text) {\r\n$return = str_replace('&lt;a', '&lt;a target=&quot;_blank&quot;', $text);\r\nreturn $return;\r\n}\r\nadd_filter('get_comment_author_link', 'comment_links_in_new_tab');\r\nadd_filter('comment_text', 'comment_links_in_new_tab');\r\n\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>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.<\/p>\n","protected":false},"author":1,"featured_media":429,"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":[5],"tags":[145,146,147,6],"class_list":["post-396","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-wordpress","tag-comments","tag-links","tag-new-window","tag-wordpress-2"],"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2015\/02\/commentslinksnewwindow.jpg?fit=808%2C650&ssl=1","jetpack_shortlink":"https:\/\/wp.me\/p1pvi1-6o","jetpack-related-posts":[{"id":311,"url":"https:\/\/pixert.com\/blog\/how-to-modify-get-comment-author-link-open-new-window\/","url_meta":{"origin":396,"position":0},"title":"How to Modify get_comment_author_link to Open Comment Authors Website on new Window","author":"Pixel Insert \/ Pixert","date":"August 21, 2013","format":false,"excerpt":"By default, get_comment_author_link \u00a0redirects 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 [php] \/\/Display website on new\u2026","rel":"","context":"In &quot;Code Snippet&quot;","block_context":{"text":"Code Snippet","link":"https:\/\/pixert.com\/blog\/category\/code-snippet\/"},"img":{"alt_text":"wordpress-logo-notext-rgb","src":"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2013\/08\/wordpress-logo-notext-rgb.jpg?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":259,"url":"https:\/\/pixert.com\/blog\/flickr-badges-open-new-window-jquery-way\/","url_meta":{"origin":396,"position":1},"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":277,"url":"https:\/\/pixert.com\/blog\/change-default-wordpress-logo-link-wordpressorg-to-your-domain-name\/","url_meta":{"origin":396,"position":2},"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":305,"url":"https:\/\/pixert.com\/blog\/wordpress-conditional-tag-to-check-specific-menu\/","url_meta":{"origin":396,"position":3},"title":"WordPress: Conditional tag to check a specific menu","author":"Pixel Insert \/ Pixert","date":"May 22, 2013","format":false,"excerpt":"Following conditional tag usually use in this filter function, wp_nav_menu_items [php]if( $args->theme_location == 'primary' )[\/php] \u00a0 [php]if( $args->theme_location == 'secondary' )[\/php] \u00a0 [php]if( $args->theme_location == 'primary' )[\/php] For an example, I want to add search box to Primary Menu in WPZOOM theme name Videozoom. Conditional tag above make sure the\u2026","rel":"","context":"In &quot;Code Snippet&quot;","block_context":{"text":"Code Snippet","link":"https:\/\/pixert.com\/blog\/category\/code-snippet\/"},"img":{"alt_text":"wordpress-logo-notext-rgb","src":"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2013\/08\/wordpress-logo-notext-rgb.jpg?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":361,"url":"https:\/\/pixert.com\/blog\/allow-wordpress-upload-flash-swf-files\/","url_meta":{"origin":396,"position":4},"title":"How to allow WordPress to upload Flash SWF files","author":"Pixel Insert \/ Pixert","date":"April 29, 2014","format":false,"excerpt":"Some banner ads still use Flash SWF\u00a0format, unfortunately Flash SWF\u00a0is one of few format that has not been permitted in WordPress for security reason. WordPress generate error like this\u201cSorry, this file type is not permitted for security reasons.\u201c when we try to upload Flash SWF\u00a0files in WordPress Previously, we wrote\u2026","rel":"","context":"In &quot;Code Snippet&quot;","block_context":{"text":"Code Snippet","link":"https:\/\/pixert.com\/blog\/category\/code-snippet\/"},"img":{"alt_text":"filetypeerror","src":"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2014\/04\/filetypeerror.jpg?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2014\/04\/filetypeerror.jpg?resize=350%2C200 1x, https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2014\/04\/filetypeerror.jpg?resize=525%2C300 1.5x"},"classes":[]},{"id":261,"url":"https:\/\/pixert.com\/blog\/cropping-post-featured-thumbnails-from-top-instead-of-center-in-wordpress-with-native-cropping-tool\/","url_meta":{"origin":396,"position":5},"title":"Cropping Post Thumbnails from Top instead of Center in WordPress","author":"Pixel Insert \/ Pixert","date":"October 14, 2012","format":false,"excerpt":"WordPress Posts \u00a0Thumbnails or Post Featured Images \u00a0is a theme feature introduced with Version 2.9. Thumbnail is an image that is chosen as the representative image for Posts, Pages or Custom Post Types. The display of this images is up to the theme. This is especially useful for \"magazine-style\" themes\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\/2012\/10\/feaimagewp-300x173.jpg?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\/396","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=396"}],"version-history":[{"count":0,"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/posts\/396\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/media\/429"}],"wp:attachment":[{"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/media?parent=396"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/categories?post=396"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/tags?post=396"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}