Delete comment replies when deleting comment in WordPress

By default when a comment is deleted, WordPress does not delete the replies of that comment. With this function whenever comment is deleted, its replies will be automatically deleted. /** * Delete comment replies when deleting comment. */ add_action( ‘delete_comment’,

Useful Linux Commands

Run command without output command > /dev/null 2>&1 Run command in background without output nohup command > /dev/null 2>&1 & List all files recursively find -type f -printf “%[email protected] %p\n” | cut -d\ -f2- Search for specific file recursively find

Cloudflare optimal & recommended settings

If you Google “cloudflare settings for wordpress” you will find a lot people giving tutorials how to speed up sites using cloudflare. Let me tell you all of them are bullshit. The more you optimize cloudflare the more problems you’re

Useful Yoast Hacks

I use Yoast SEO on all of my wordpress setup. Here are some hacks that I use for it. Disable Yoast JSON-LD Completely add_filter( ‘wpseo_json_ld_output’, ‘__return_false’ ); Noindex paginated pages Since the version 7.0 Yoast SEO started paginated pages indexation

Stop generating additional image sizes in WordPress

Whenever you upload image to media library, WordPress will automatically generate additional images with 3 default image sizes and store them separately. Then your theme and plugins will generate some additional image sizes too. In my case total of 13

How I put a stop to spam in Contact Form 7

Contact Form 7 Limit Submissions: Unfortunately there was no available plugins or codes to limit the submissions in Contact Form 7, so I built one. This is how I built it. Create Table in Database: First I created a table

Useful Nginx Hacks

The Regular Expression translates to: “rewrite all URLs without any ‘.’ (dot) in them that don’t end with a ‘/’ to the URI + ‘/’” Or simply: “If the URI doesn’t have a period and does not end with a

Useful RunCloud Hacks

In this page I shared all the RunCloud hacks that I have been using. 1) WordPress under subdirectory in Nginx If you want to install WordPress under subdirectory in RunCloud Native Nginx stack, then this will help you configure it.

How I almost got hacked

This is a story about how I almost got hacked. By “almost” I meant the virus infected me but the attacker did not accomplish what he was supposed to. Let me tell you briefly. Today I was debugging & testing

How I discovered faulty code in a WordPress theme

Update: I can’t seem to reproduce the issue anymore. I don’t know what exactly happened. I have been using Publisher WordPress Theme by Better-Studio for a long time. 5 of my clients uses it. And to be honest this is

Force HTTPS non-www or www using .htaccess

Use the following codes on .htaccess to force non-www or www on your site. The below codes works perfectly when your setup using Nginx in front of Apache as a reverse proxy. Force non-www + HTTPS # Force non-www+https <IfModule

Nginx config for Cloud Torrent

If Cloud Torrent setup not working with Nginx, try the below codes. Nginx as Reverse Proxy location / { proxy_pass http://127.0.0.1:63000; } location /sync { proxy_pass http://127.0.0.1:63000; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; } Native Nginx location /

Filemasking in DigitalOcean Spaces Sync

DigitalOcean Spaces Sync plugin connects your WordPress Media Library to a container in DigitalOcean Spaces. It syncs data such as images, attachments from your website to DigitalOcean Spaces Object Storage and replaces links to images (optional). You may keep the

Increase Swap in Linux

Swap space is fake memory that is actually disk space. The purpose of swap space is to be emergency overflow memory. Normally, if your server runs out of memory, the Linux kernel has to decide which processes to kill to