How to force all links on content to open in new browser window ?

You can make every link in the posts created by WPeMatico open in a new browser tab with a single rewrite in your campaign. It adds the target="_blank" attribute to all the links in the content.

Enable the Rewrite Feature
Show the Rewrite options box in your campaigns.

Go to WPeMatico β†’ Dashboard, find the Rewrite Rules card and turn on its switch.

Rewrite rules card in the wpematico dashboard

You can also do it from WPeMatico β†’ Settings β†’ Advanced: in the Enable Features box, turn on Enable “Rewrite” feature and click Save settings.

Enable rewrite feature option in wpematico settings

Add the Rewrite to the Campaign
One row is enough.

  1. Edit the campaign and find the Rewrite options box.
  2. In Origin, type: /<a(?=\s)/i
  3. In Rewrite to, type: <a target="_blank" rel="noopener"
  4. Check RegEx and leave Title unchecked, so the change is made in the content.
  5. Click Update to save the campaign.

Rewrite row that makes the links open in a new tab in a wpematico campaign

The expression finds the beginning of every link tag, so a link like <a href="https://example.com"> becomes <a target="_blank" rel="noopener" href="https://example.com">. The rel="noopener" attribute is a good practice for security when links open in a new tab.

Note: The rewrite applies to the posts created from then on. Posts already published keep their links as they were.

Related FAQs