Plugin to get a database backup from a WordPress installation

I usually want to extract a database backup from my live WordPress installations. Sometimes I am lucky and can ssh into the machine and use mysqldump directly and sometimes I need to use PHPMyAdmin.

But, every now and again I loose my login details to all those different hosting companies and it would be nice to get a database dump directly from the WordPress installation itself.

One plugin that solves this for me, is WP Migrate DB, so if I just can remember how to login to the WordPress installation, then it will be quite easy to get the wanted database dump.

Enable automatic update of WordPress and skip FTP details

I want to use the automatic update of WordPress which seems to work fine on hosting services but not on my local installation.

I try to solve it by doing chmod -R 777 on the installation, but that does not do the trick on its own.

Adding a row like this to wp-config.php however does the trick.


An explanation of why it is like this, was found in this excellent StackOverflow response.

Adding comment and like count to WordPress plugin Simple Instagram

This is really not a proper way of doing it, but I did it anyway.

I have this WordPress plugin for Instagram, Simple Instagram its called. I thought it would be nice to have the comment count and like count when hovering over the images. So, just for fun I tried to edit the existing plugin to make it work. Here are my notes on how I did it.

Continue reading Adding comment and like count to WordPress plugin Simple Instagram

Optimize images for web usage and enhanced rating in Google Pagespeed

The rating for your website on services like Google PageSpeed might indirectly affect how your website rank in the serp. One area that Google PageSpeed measures is how well you have optimized your images. You should therefore optimize your images to keep up your rank in the serp.

Myself I use several techniques for that.

One is the PHP-script image.php which helps me scale and process the images serverside, including running extra tools for image optimization during the process.

Another useful tool is to check the /img directory and run a bash-script that optimizes the images of my selection.

Change the location of the image upload directory in WordPress

I always change the WordPress default upload directory for images, I usually want it somewhere in a subdirectory of the /img directory, together with all other images. I find it easier to manage all images when they are stored in one location.

So, for my own personal note, this is what I do. In the file wp-config.php I set the relative path to the image directory.

// Directory for uploading images
define('UPLOADS', '../img/wp');

Now, all images will reside in this directory. Be sure to verify that upload works. The directory path must be relative the installation directory of WordPress and the UPLOADS directory must be writable by the webserver.

Check and change WordPress site & home location using SQL

I tend to move around the WordPress sites, moving from one development server to another and moving between hosting companies.

The SQL-queries below, tend to be most useful when moving these installations between hosts and directories. They check, and set, where the WordPress installation directory is (siteurl) and what the home url should be (home).

First check.

SELECT * FROM wp_options WHERE option_name IN ('siteurl', 'home');

Then set it.

UPDATE wp_options SET option_value='' WHERE option_name='siteurl';
UPDATE wp_options SET option_value='' WHERE option_name='home';

I find it much easier doing this by SQL than using the admin interface.