Created
June 13, 2024 08:57
-
-
Save wplit/e439d37d5750cbb8428ad6c88ddaa8f1 to your computer and use it in GitHub Desktop.
remove 'target' attribute from social share element links (https://academy.bricksbuilder.io/article/filter-bricks-element-render_attributes/)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'bricks/element/render_attributes', function( $attributes, $key, $element ) { | |
$element_name = "xsocialshare"; | |
if ( $element_name === $element->name && strpos( $key, "link-") === 0 ) { | |
foreach($attributes as $attr=>$row){ | |
unset($attributes[$attr]['target']); | |
} | |
} | |
return $attributes; | |
}, 10, 4 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment