Skip to content

Commit e6bd504

Browse files
committed
Add rel="noopener" to a tag using target="_blank"
Learn more about this here https://developers.google.com/web/tools/lighthouse/audits/noopener
1 parent bcd7ee1 commit e6bd504

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

functions.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ function fredo_post_thumbnail( $size = 'full' ) {
123123
*/
124124
function fredo_apply_button_class_to_last_menu_item( $item_output, $item, $depth, $args ) {
125125
if ( apply_filters( 'fredo_last_menu_item_name', 'buy-a-coffee' ) === $item->post_name ) {
126-
$item_output = preg_replace( '/<a.*?>(.*)<\/a>/', '<a href="' . $item->url . '" class="button button-black" target="_blank">$1</a>', $item_output );
126+
$item_output = preg_replace( '/<a.*?>(.*)<\/a>/', '<a href="' . $item->url . '" class="button button-black" target="_blank" rel="noopener">$1</a>', $item_output );
127127
}
128128
return $item_output;
129129
}
@@ -298,16 +298,16 @@ function fredo_promote_theme_box() {
298298
</div>
299299
<div class="row">
300300
<div class="column">
301-
<span><a class="button button-outline" href="https://github.com/corsonr/fredo/archive/master.zip" target="_blank"><?php esc_attr_e( 'Download', 'fredo' ); ?></a></span>
301+
<span><a class="button button-outline" href="https://github.com/corsonr/fredo/archive/master.zip" target="_blank" rel="noopener"><?php esc_attr_e( 'Download', 'fredo' ); ?></a></span>
302302
</div>
303303
<div class="column">
304-
<span><a class="button button-outline" href="https://github.com/corsonr/fredo/issues" target="_blank"><?php esc_attr_e( 'Report a bug', 'fredo' ); ?></a></span>
304+
<span><a class="button button-outline" href="https://github.com/corsonr/fredo/issues" target="_blank" rel="noopener"><?php esc_attr_e( 'Report a bug', 'fredo' ); ?></a></span>
305305
</div>
306306
<div class="column">
307-
<span><a class="button button-outline" href="https://github.com/corsonr/fredo/blob/master/CONTRIBUTING.md" target="_blank"><?php esc_attr_e( 'Contribute', 'fredo' ); ?></a></span>
307+
<span><a class="button button-outline" href="https://github.com/corsonr/fredo/blob/master/CONTRIBUTING.md" target="_blank" rel="noopener"><?php esc_attr_e( 'Contribute', 'fredo' ); ?></a></span>
308308
</div>
309309
<div class="column">
310-
<span class="support"><a class="button button-outline" href="<?php echo esc_url( fredo_buy_me_a_coffee_url() ); ?>" target="_blank"><?php esc_attr_e( 'Buy me a coffee', 'fredo' ); ?></a></span>
310+
<span class="support"><a class="button button-outline" href="<?php echo esc_url( fredo_buy_me_a_coffee_url() ); ?>" target="_blank" rel="noopener"><?php esc_attr_e( 'Buy me a coffee', 'fredo' ); ?></a></span>
311311
</div>
312312
</div>
313313
<?php

single.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@
5959
<div class="column">
6060
<span class="title"><?php the_author(); ?></span>
6161
<span class="bio"><?php echo nl2br( get_the_author_meta( 'description' ) ); ?></span>
62-
<span class="social"><a class="button button-outline" href="https://twitter.com/intent/user?screen_name=remicorson" target="_blank"><?php esc_attr_e( 'Follow', 'fredo' ); ?></a><br /><?php esc_attr_e( 'Followed by ±3K people', 'fredo' ); ?></span>
63-
<span class="support"><a class="button button-outline" href="<?php echo esc_url( fredo_buy_me_a_coffee_url() ); ?>" target="_blank"><?php esc_attr_e( 'Buy a coffee', 'fredo' ); ?></a><br /><?php esc_attr_e( 'Show your support', 'fredo' ); ?></span>
62+
<span class="social"><a class="button button-outline" href="https://twitter.com/intent/user?screen_name=remicorson" target="_blank" rel="noopener"><?php esc_attr_e( 'Follow', 'fredo' ); ?></a><br /><?php esc_attr_e( 'Followed by ±3K people', 'fredo' ); ?></span>
63+
<span class="support"><a class="button button-outline" href="<?php echo esc_url( fredo_buy_me_a_coffee_url() ); ?>" target="_blank" rel="noopener"><?php esc_attr_e( 'Buy a coffee', 'fredo' ); ?></a><br /><?php esc_attr_e( 'Show your support', 'fredo' ); ?></span>
6464
</div>
6565
</div>
6666

0 commit comments

Comments
 (0)