WordPress: show similar articles without plugins


In this article, I propose a PHP function to display similar articles on your WordPress site.

Following the hacking of the plugin Yuzo Related Post that I used on the site, I finally decided to do without plugin to do that.

To have a demo, I invite you to browse the site to see the result.

The code

In the file functions.php of your WordPress theme add the function below:

The display is based on the Bootstrap.

In the theme’s article display file, call the function with the following code:


If you have some knowledge in PHP, it’s easy to customize the function and have something you manage the code for.

I’m not against plugins, which is the strength of WordPress, but for some features, it is still better to do things even that which reduces the risk for your site.

A function of 60 lines (it could do less) will replace a plugin of almost 200 files without really knowing the content and how your site is affected by it.

Related Posts

Ubuntu: install a web server – NGINX / PHP / MariaDB

PrerequisiteInstallation of the various componentsInstall NginxConfigure the nginx userTest the Nginx serverInstall PHPAdd the repositoryView available PHP versionsInstall a version of PHPConfigure NG

PHP on IIS: Installation and Configuration

Table Of ContentsPresentation PrerequisitesPHP installationInstalling PHP Manager for IISPHP configurationEnable a PHP extensionUse different versions of PHP depending on the sites Presentation In thi