snippets

How to add featured image to WordPress RSS feed

Recently I came across a situation when I wanted to add the featured image of the posts to my RSS Feed. By default WordPress does not shows the Featured Image in the RSS Feed. This can be easily achieved by adding a few lines of code in the functions.php file of the theme. Important: Make …

How to add featured image to WordPress RSS feed Read More »

How to hide Nginx version number in headers and errors pages

In default Nginx configuration, the server sends HTTP Header with the information of Nginx version number of the Server. The HTTP response header “Server” displays the version number of the server. This information can be used by hackers to try to exploit any vulnerabilities in the Nginx, specially if you are running an older version …

How to hide Nginx version number in headers and errors pages Read More »

How to get size of BLOB in MySQL

Recently I wanted to get the size of the data stored in the BLOB field of a MySQL table. BLOB is a field which can be used to store variable amount of data. There is a simple MySQL String function, to find the size of BLOB data, OCTET_LENGTH. This function returns the length of BLOB …

How to get size of BLOB in MySQL Read More »

How to apply a function to every array element in PHP

I often come across situations in which I need to apply some function to every element of an array in PHP. For example, to sanitize the user input, function like htmlentities can be used. We can easily use this function on a single variable or a single dimension array by simply applying the function or …

How to apply a function to every array element in PHP Read More »

How to remove WordPress version parameter from JS and CSS files

In my last post I mentioned how we can remove WordPress version number from the page source and RSS feeds. However, they are not the only places where we can identify the WordPress version number. Many CSS and JS files in the WordPress also have the WordPress version number appended to their source. In this …

How to remove WordPress version parameter from JS and CSS files Read More »