Title: Automatic URL conversion
Author: Tobias Bäthge
Published: December 30, 2012
Last modified: May 8, 2025

---

# Automatic URL conversion

**Download**:
[Automatic URL conversion Extension 1.3](https://tablepress.org/download/extension/tablepress-automatic-url-conversion.zip?output_format=md)

To add links to table cells, you’ll in general need to manually enter the HTML code
for a link (something like `<a href="https://www.example.com/">My Link</a>`) into
a cell or use the “Insert Link” button, that will ask you for the URL and the link
text and then generates the necessary HTML code for you. This is the recommended
way and for most needs it works fine. It also allows for the most flexibility, because
you have all freedom to alter or extend that HTML code as you like, e.g. by adding
further attributes or a different link text.

Unfortunately it can be a real hassle and a lot of work, if all you want to achieve
is, to make URLs you enter “clickable”, i.e. to make them valid HTML links. That
can for example be the case when you import a table from a file, because in most
cases URLs are not exported as HTML links by a program but simply as the plain URL
in text form.

And this is were this Extension kicks in. When a table is shown in a post or page,
the Extension will check if there’s an URL (for www, ftp or an email address) somewhere.
And if it finds one, it will replace the URL with a complete HTML link to that URL
that can be clicked by the visitor. The good thing: If there already was a complete
HTML link, it will be left intact.

Here’s an example:

A cell with the content

    ```language-xml
    https://www.example.com/Code language: HTML, XML (xml)
    ```

will automatically be converted to a clickable link:

    ```language-xml
    <a href="https://www.example.com/">https://www.example.com/</a>Code language: HTML, XML (xml)
    ```

To use this, download, install, and activate the Extension like a regular WordPress
plugin. Then, on the page where you want to show the table, insert the extended 
Shortcode

    ```language-plaintext
    [table id=123 automatic_url_conversion=true /]Code language: plaintext (plaintext)
    ```

and change the `123` to the desired table ID. This will activate the automatic URL
conversion for that table.

Additionally, some people might want to have links open in a new browser window 
or tab automatically (Note that this is not recommended by web experts, as it takes
away the user’s freedom and is considered bad for accessibility reasons. Personally,
I totally agree with them, I hate when a site does this.). If you also want to do
that, just extend your Shortcode with another parameter, to

    ```language-plaintext
    [table id=123 automatic_url_conversion=true automatic_url_conversion_new_window=true /]Code language: plaintext (plaintext)
    ```

The `automatic_url_conversion_new_window` will add the HTML `target="_blank"` attribute
to the link HTML, which tells the browser to open the link in a new window or tab.

If you want links to have the `rel="nofollow"` attribute set, so that search engines
don’t follow the link, just add the `automatic_url_conversion_rel_nofollow` parameter
to the Shortcode:

    ```language-plaintext
    [table id=123 automatic_url_conversion=true automatic_url_conversion_rel_nofollow=true /]Code language: plaintext (plaintext)
    ```

If this Extension is useful for you, please check out the available [TablePress Premium features](https://tablepress.org/modules/)
and consider getting a [Premium license plan](https://tablepress.org/pricing/), 
which bring even more features for you and your site visitors. Thank you!