Skip to content
Custom fields for WordPress that are quick to build and quick to load. Get Pro

Structured data and templates

A link that opens in a new tab, safely

A link field printed with the right target and rel attributes.

1 minute Works with the free plugin

PHP
<?php $link = ugly_get( 'link' ); ?>
<?php if ( $link ) : ?>
	<a href="<?php echo esc_url( $link['url'] ); ?>"
		<?php echo '_blank' === $link['target'] ? 'target="_blank" rel="noopener noreferrer"' : ''; ?>>
		<?php echo esc_html( $link['title'] ); ?>
	</a>
<?php endif; ?>