How do I set to open links in new window?

Links open in same window taking user out of website. How can I set to open in new window?


    Alternatively, you can set links to open in a new window manually by using the "target" attribute when you build your link. For instance, your link might look like:

    <a href="" target="_blank">

    EDIT: If you are comfortable editing the plugin itself to do this automatically, you can follow these steps (assuming plugin version 1.5) - remember to always back everything up in case something fails along the way:

    1. Go to: wp-content/plugins/buddypress-activity-plus/lib/bpfb_group_documents.php
    2. Find the line 187: '<a href="' . bp_get_group_permalink($group) . '">' . bp_get_group_name($group) . '</a>'
    3. Change to: '<a href="' . bp_get_group_permalink($group) . '" target="_blank">' . bp_get_group_name($group) . '</a>'



    @Taye - Yep! If you're using a text editor, you can search the document for this comment: Creates the activity info message. - the code that's referenced in the previous post is in the function directly following this comment. I've taken a screenshot and highlighted the code for your reference.

    Let me know if you still can't find it.

    - Nick


    Hi again @Taye

    I took a look in images_tag_template.php and link_tag_template.php and, lo and behold, there is a constant referenced there that you can override to open external links in a new window.

    Simply add the following to your wp-config.php file:

    define('BPFB_LINKS_TARGET', true);

    I'm going to update the usage docs with this too... now that I know about it


    Can you be more specific about where to add the code in the wp-config.php file? I don't know html code. Is this part of the plugin code? Will there be a plugin update coming? Diddling with the code makes me very nervous.



    The wp-config.php file is the same file you would have edited when you first installed WordPress on your site to add your database name, username and password.

    It is in your wp-content folder that you can access either via FTP or, if you use cPanel at your host, you can use the File Manager feature.

    You would need to open wp-config.php in a text editor (not a word processing program like MS Word as that adds formatting that would render the code useless, and likely mess up other things too).

    Add the code above just before the line that says
    "That's all, stop editing".

    Then save and re-upload the file.