Posts in Code Snippets

Magento Delete All Tables Prefixed With ‘wp_’

Ever installed Magento using a one click installer and forgot to remove the “wp_” prefix ?

Simple to remove your tables ? Nope ! pesky Foreign Key Constraints !

Try this code in your favourite MySql program. Please note running the resulting SQL code this will immediately delete all of your databases prefixed with “wp_” so if you are not sure back up ! Read More

Highlight Current Post Category In WordPress Categories Widget Using jQuery PHP

This simple snippet of PHP code will apply the ‘current-cat’ class to any categories in the WordPress categories widget that the current post resides in.

Add this code to your single.php template file in your current template. Make sure you have a .current-cat class in your css.

This assumes jQuery is included and uses $ to declare it.

WordPress Spam BuddyPress Easy MySQL Spam Filter Query

Wordpress spam sign ups are a real pain. If you need to do some work on the database to do a mass clean-up of spam users. I created this little MySql query which basically counts the number of full-stops or dots in an email address. Having recently done this for a client, I noticed a pattern especially in @gmail accounts where the same word is used as an email address but has full stops positioned in different places in the email address. To the human eye this sticks out like a sore thumb. So in order to check via a query I created this query. Read More