I want to talk about the similarities and differences between plugins and themes and why and how we use both, but most importantly, how I think the integration of plugins in a theme should be implemented.

Why this article?

There are a few problems that I regularly have or had to do with.


There are several fields you can use to create your posts, such as title, excerpt, content, author and taxonomy terms which come with a standard user interface. But sometimes this is not enough and you want to add more meta information about your post.

This article shows different possibilities to…


There are several fields you can use to create your posts, such as title, excerpt, content, author and taxonomy terms which come with a standard user interface. But sometimes this is not enough and you want to add more information about your post.

This article shows different implementations to add…


There are at least three ways to implement Ajax endpoints in WordPress plugins or themes. Admin-Ajax is something that has been around forever and WP_REST is the “new” way. Rewrite rules are another approach. …


If you provide frontend output with your plugin, it is important that other developers can modify it for theming purpose. This can be done via filters or actions but I think the easiest and most common way is to provide template paths that can be overwritten.

It is common practice…


Today I would like to talk about a security aspect of WordPress. As by far the most used CMS on the Internet, it is a very attractive target for hackers. But it’s also easy to protect your website from the most common attack scenario.

There are bots that crawl the…


WordPress plugins can be as simple as a few functions, but they are more often very complex. This usually leads to a lot of require paths that you need to maintain. But file path strings will be very tricky for future code refactoring. So what if we could skip writing…


It’s a common task to use external services to extend the functionality of your website. Some examples would be weather information or traffic data. But there are tons of other use cases. The best that can happen is if you can use client-side code. But most of the times you…


Gutenberg is the “new” content editor that comes with WordPress 5.0 and later. It replaces TinyMCE that was used before. …


Some things need to be done when they need to be done. This could be publish planned posts, automatically updating plugins or themes, cleaning up your system or retrieving data from an external service. For those tasks WordPress has a schedule implementation. Those schedules have some serious disadvantages and should…

Write better WordPress code

Suggestions how to write clean plugin and theme code by experienced developers.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store