All Posts in Code

December 6, 2016 - No Comments!

How to remove WordPress comments without plugins

Would you remove WordPress comments without using plugins?

In this article I'll explain how to completely remove WordPress comments without installing any plugin.

One of the main advantages of WordPress is the presence of its plugins, which often resolve most of the needs without particular difficulties. Although surely the plugins can help, you should evaluate them individually, deciding in each case whether they are really useful or if you can solve your problem with few lines of code.

Read more

November 5, 2016 - No Comments!

How to protect WordPress adding file permissions

Do you want to make secure your website, protect WordPress and complicate the lives of bad guys?

In this post I will explain how and which permissions apply to your website to protect WordPress

If you are reading this guide, you're probably in my same situation. A few months ago one of my websites was constantly hacked and I was losing hours in continuous clean-up operations... Boring, isn't it?

Read more

September 19, 2016 - No Comments!

How to limit WordPress revisions to save your database

First of all: What is WordPress revisions? WordPress saves revisions and stores a record into database for each saved draft. This could be useful to roll back to any previous post or page version; quite interesting uh? This revisions of this system, however, threatens to massively increase your database sizes, thus slowing your website.

As described WordPress revisions can be useful, but it would be interesting to be able to limit them to a maximum number, saving your database health.

In this article we will see how to restrict the maximum number of revisions in a simple way and especially without using plugins.

Read more

May 28, 2016 - No Comments!

How to add a new admin user to WordPress via PHPMyAdmin

First of all this article intends to help all admins who are unable to login to WordPress control panel and aren't able to reset the password using the standard WordPress procedure, and so the only way is to add an admin user via database.

Sometimes you may need to add an admin user to a WordPress site via PHPMyAdmin; this short tutorial could help you accomplish this safely, using only a few queries.

Please note, I suggest you to backup your database as first step, so you could restore it if some problems arise.

Ok, do you save the backup in a safe place? Ok, let's go!

First of all log into your PHPMyAdmin interface, click on "SQL" label (on top right panel) and then copy and paste these lines:

Read more

May 16, 2016 - No Comments!

How to add allowed html tags on WordPress

WordPress is making great strides in security, but sometimes we need more control over the HTML tags allowed to be used in comment and post content.

Are you ready? Let's take a look to "wp_kses_allowed_html" filter, to add more allowed html tags to use in your WordPress themes and plugins.

KSES is an HTML filtering system used by WordPress to seek through variables looking for HTML, it strip all HTML tags except the allowed ones. This functionality was implemented to prevent intruders can inject malicious code in your WordPress site; great, isn't it? 🙂

Read more