
Automatic Links

Description
Automatic Links is a PHP class that allows you to automatically apply links on a HTML document.
This class is already in use in other products from our portfolio. In particular, it’s adopted to apply the automatic links in WordPress plugins with thousands of users, like Interlinks Manager.
How the class applies the automatic links
This class uses PHP regular expressions to generate the links from a list of keywords and URLs provided by the user.
It’s worth noting that this class gives you total control over the algorithm used to apply the links. Specifically, you can configure a high number of options both at the class level and at the automatic link level to:
- Limit the maximum number of automatic links to a specific number
- Select between a case sensitive or a case insensitive search of the keyword
- Add the Nofollow attribute on the link element
- Set a custom title attribute on the link element
- Open the links in the same tab or a new tab
- Find only the occurrences of the keyword preceded or followed by a specific string
- Configure specific word boundaries based on the particular context or language
- Prioritize individual keywords over the others
We have also included other advanced features for the most demanding users. For example, you can:
- Prevent the application of the automatic link on specific HTML elements
- Improve the distribution of the automatic links with the “Random Prioritization” feature
- Prevent the application of the automatic links that target the current URL
- Limit the maximum number of automatic links based on the length of the provided string
- Limit the maximum number of automatic links that target the same URL
How to use the class
The simplest usage example of this automatic links class:
require_once( 'inc/class-daext-automatic-links.php' );
$automatic_links = new DaextAutomaticLinks();
echo $automatic_links->add_autolinks( '<p>Buy my book.</p>',
[
[
'keyword' => "book",
'url' => "
]
]
);
The above example will output:
<p>Buy my <a href=">book</a>.</p>
This other script uses advanced options to:
- Open the generate links on a new tab
- Limit the number of automatic links to two
- Protect specific tags
require_once( 'inc/class-daext-automatic-links.php' );
$automatic_links = new DaextAutomaticLinks();
$automatic_links->set_options(
[
'open_new_tab' => true,
'general_limit_amount' => 2,
'protected_tags' => [
'h1',
'h2',
'h3',
'h4',
'h5',
'h6',
'strong',
'pre',
'code'
]
]
);
$article = '<h2>iPhone 14 range</h2>';
$article .= '<p>The iPhone 14 is an obvious pick on our list.</p>';
echo $automatic_links->add_autolinks( $article,
[
[
'keyword' => "iPhone 14",
'url' => "
]
]
);
The above example will output:
<h2>iPhone 14 range</h2><p>The <a target="_blank" href=">iPhone 14</a> is an obvious pick on our list.</p>
Note that more examples are available in the class demo and the plugin manual.
Updates
15.03.2022 - v1.05 - Improved documentation 14.03.2022 - v1.03 - First release
Do you care about your website’s SEO?
Improve your internal links structure and get more visits on your WordPress website with the Interlinks Manager plugin.

Categories
Tags
External listing. code.market does not sell this product and does not process payment for it. Pricing, payment, delivery, licensing, refunds, and support are handled by the third-party merchant on its own website. We may earn an affiliate commission from a referral. Details.
Products of the Week.
Submit🥇
STOP GUESSING WHAT TO POST
AI that learns your brand voice and builds a month of consistent, on-brand social content: carousels, posts and hooks that sound like you, not like everyone else's AI.
SaaS · 4,291 views · 38 clicksSaaS · Week 45 · 4,291 views · 38 clicks
🥈
Conversational Backlinks for Busy Founders
Place Backlink Relevant Conversation for your domain across Forums and Conversations
Website · 42,004 views · 223 clicksWebsite · Week 45 · 42,004 views · 223 clicks
🥉
upvote.club
Free Social Media Engagement that Helps Boost Your Content. Upvote Club supports 19 social networks with 100+ engagement actions in one dashboard. Add links to your posts and get free engagement from real users.
SaaS · 40,046 views · 117 clicksSaaS · Week 45 · 40,046 views · 117 clicks
#4
Substack Posting API
Onboard your Agent to Substack. Write Publish on Substack via API
SaaS · 59,055 views · 198 clicksSaaS · Week 45 · 59,055 views · 198 clicks
#5
Seenshot App
Free, Fast, MacOS Screenshot app. Make Screenshot cmd+shift+2 and send it via link
Desktop App · 28,432 views · 122 clicksDesktop App · Week 45 · 28,432 views · 122 clicks
#6
Hand-Placed Backlinks $9.99 per link. Flat rate.
Buy hand-placed forum, Q-A and directory backlinks. Flat $9.99 per link, no subscriptions — you only pay for approved listings.
Website · 4,265 views · 19 clicksWebsite · Week 45 · 4,265 views · 19 clicks
#7
Free Invoice Generator - PDF Invoices in Your Browser, No Sign-Up
A free invoice maker for freelancers and small businesses: fill in the invoice, check the live preview, and download a PDF that looks exactly like it. Any currency, tax per item, three templates, no sign-up, and nothing leaves your device.
2,940 views · 17 clicksWeek 45 · 2,940 views · 17 clicks
#8
Merge PDF Files Free - Combine PDFs in Your Browser, No Upload
A free PDF merger for office workers, students, and freelancers: combine PDFs and images into one file in the browser, reorder files and pages, pick page ranges, keep bookmarks, and open password-protected PDFs. Nothing is uploaded, no sign-up, no watermark.
2,717 views · 13 clicksWeek 45 · 2,717 views · 13 clicks
