Written by Admin on 2025-05-06
How to Open WordPress Plugin Downloads in a New Tab
If you've ever tried to download a WordPress plugin, you may have noticed that by default, the download link opens in the same tab. This can be frustrating if you want to continue browsing while the download is in progress, or if you accidentally close the tab and need to start the download again.
Fortunately, it's easy to change this behavior so that plugin downloads open in a new tab. Here's how to do it:
- Log in to your WordPress site and go to the "Plugins" page.
- Click the "Add New" button at the top of the page to go to the plugin repository.
- Right-click the "Download" button for any plugin you want to download.
- Select "Copy link address" from the context menu.
- Go to your website dashboard and click on "Appearance" and then "Theme Editor"
- On the Theme Editor page on the right side (you may need to scroll there), find and click on the file
functions.php
- Add the following code at the bottom of the file:
php
function custom_plugin_download_link($link, $plugin_file, $plugin_data) {
return str_replace(' href=', ' target="_blank" href=', $link);
}
add_filter('plugin_row_meta', 'custom_plugin_download_link', 10, 3);
- Click "Update File" to save your changes.
That's it! Now, when you click on a plugin's "Download" button from the Plugins page, the download link will open in a new tab. This makes it easy to continue browsing and working on your site while the download is in progress.
If you ever want to undo this change and go back to the default behavior, simply remove the code you added to the functions.php
file and save the changes.