Change social icons to open in same tab

[ad_1]

Hello @peaktoplate,

I don’t think the simple social icons plugin has a setting or filter to change the target attribute value.

You could use a bit of JavaScript to modify the link target and set it to open in the same window.

Here is an example:

function modify_simple_social_icons_link_target() {
    ?>
    <script>
        document.addEventListener('DOMContentLoaded', function() {
            var socialIcons = document.querySelectorAll('.simple-social-icons ul li a');
            socialIcons.forEach(function(icon) {
                // Set the target attribute to '_self' to open links in the same window
                icon.target="_self";
            });
        });
    </script>
    <?php
}
add_action('wp_footer', 'modify_simple_social_icons_link_target');

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer