Plugin Author
Vova
(@gn_themes)
Hi @irongenetics96,
I’ll add an option to disable this behavior. Thank you for the report.
Thread Starter
Ironos
(@irongenetics96)
@gn_themes thank you – around when will you do this option? Don´t want to change 800 buttons manually^^
Plugin Author
Vova
(@gn_themes)
@irongenetics96,
in a week or so.
Please subscribe to this topic. Probably, you’ll need to add some code to the functions.php file.
Isn’t that a “forced” behavior from Gutenberg to all _blank links?
Plugin Author
Vova
(@gn_themes)
Hi Andre,
Sorry for the late reply.
This behavior isn’t related to Gutenberg.
Please add the following code to the end of the functions.php file:
add_filter( 'shortcode_atts_button', function( $atts ) {
if ( 'blank' === $atts['target'] && '' === $atts['rel'] ) {
$atts['rel'] = 'noopener';
}
return $atts;
}, 10, 1 );
The code above will set rel value to noopener if target=blank. By default, if target=blank and rel is empty, rel is automatically set to noopener noreferrer.
Thread Starter
Ironos
(@irongenetics96)
Hey all my buttons had before just rel “nofollow” and open in a new tab. Like 2 updates before there was noopener added, do i have to edit it now manually with the code above?
Thanks
Plugin Author
Vova
(@gn_themes)
You don’t have to do anything if you already have rel=nofollow in your shortcodes. Example:
[su_button target="blank" rel="nofollow"] ... [/su_button]
will now be displayed as
<a target="_blank" rel="nofollow"> ... </a>