Home Experience & Tips Sharing Standard Post

Standard Post

2 Simple Methods to Open WordPress Website Post Links in a New Window

How to set article links in a WordPress website to open in a new window? This article introduces two very simple methods to achieve opening links in a new window. Method 1: Check the option to open in a new window when adding a link. The specific method is as follows: when inserting a hyperlink in an article, select link settings or link options, and then check the box to open in a new window. Gutenberg editor...

Published on November 27, 2019 About 2 minutes read
2种简单的WordPress网站文章链接新窗口打开方法

How to set WordPress post links to open in a new window? This article introducestwo very simple methods to achieve opening links in a new window

Method 1: Check 'Open in new window' when adding a link

The specific method is as follows: when inserting a hyperlink in a post, select the link settings or link options, then check 'Open in new window'.

链接新窗口打开

The Gutenberg editor link new window opening setting effect is as shown above.

链接新窗口打开

The classic editor link new window opening setting effect is as shown above.

Method 2: Insert a base tag to make all site links open in a new window

<base> is an HTML language tag. Through its attribute values, you can set the default opening method for links on a website. The URL opening attributes in tags including <a>, <img>, <link>, and <form> will be affected by the base value.

链接新窗口打开

Specific implementation method:

  1. WP Admin > Appearance > Theme Editor > header.php
  2. Insert code on the next line after <head>
<base target="_blank" />

base tag attribute value

Description
_blankOpens the linked document in a new window.
_selfDefault. Opens the linked document in the same frame.
_parentOpen the linked document in the parent frameset.
_topOpen the linked document in the entire window.
framenameOpen the linked document in the specified frame.

The above two methods can easily achieve opening links in a new window. If you don't want the entire site to open in a new window, but the link is not within an article, you can directly edit the link tag attributes of the corresponding position on the webpage template and add target="_blank".

3.7/5 - (3 votes)
Previous Which is better, SiteGround or GoDaddy? Who is more recommended? Continue reading content around the same timeline. Next WordPress Plugin for Creating Test Website Environment: WP Staging View the next related tutorial or experience.

AI Website Building Assistant

🤖
Hello! I am the Naibabiji AI Assistant. How can I help you?
Quick Consultation: