Clean Up Orphaned postmeta Data

Sometimes you run into a time where you need to go into the database and delete items from the posts table.  So after doing this you could have a lot of extra data getting stored in the postmeta table that is no longer needed.  This is a simple MySQL command that can...

Create CSV File using PHP

Came across this nice little bit of code to write a CSV file on the fly using PHP and grabbing the data from a MySQL database.  Thank you Stephen Morley for authoring a great little how to. Create Downloadable CSV File using PHP // output headers so that the file is...

Import MySQL from Command Line

Here is the code to run a sql file within a specified database. Import MySQL from Command Line PHP mysql -u DB_User -p DB_Name < sql_file.sql 1 mysql -u DB_User -p DB_Name < sql_file.sql...

Manually Modifying WordPress’s URL via SQL

Sometimes it is easiest to modify the URL globally through SQL.  Here are the main commands you are going to want to run to modify the URL's throughout the database. SQL MySQL UPDATE wp_options SET option_value = replace(option_value, 'http://www.oldurl',...

WordPress Databases – Using dbDelta

There are plenty of times you need to create extra database tables for storing data within WordPress.  Sometimes a scope of an addon has changed and you need to modify the table.  Using dbDelta within WordPress can allow you to modify the table without having to use...