Hash user emails in database?

Hashing is a one-way function, meaning you can’t get back an original string from a hash value. You could use the PHP function mcrypt_encrypt to “encrypt” the email address and mcrypt_decrypt to convert it back. If you went that route, you could hook into password_reset to decode the email address before the password reset is … Read more

Error establishing a database connection for some files

This is most likely a file permission issue on the server. If the file is visible on the file system but not rendering properly in the browser it typically means: 1) The web server (apache, iis, nginx) can’t see the file because it’s assigned to the wrong owner:group or the permissions are set too restrictively … Read more

Geographical proximity query using post_meta

Oh dear, that was extremely obvious – there was a missing closing bracket! Here is the working query. SELECT ID, ( 6371 * acos ( cos ( radians( 35.665833 ) ) * cos( radians( latitude.meta_value ) ) * cos( radians( longitude.meta_value ) – radians( 139.731111 ) ) + sin ( radians(35.665833 ) ) * sin( … Read more

Split database on large site?

I had a similar issue on a website with ~100k rows in wp_posts and ~500k in wp_postmeta. Truth is WordPress have some really slow queries in the admin when you start to have a lot of posts. The best way to find the bottleneck is to use the Debug Bar plugin. You will probably find … Read more