by greg | Sep 30, 2016
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...
by greg | Aug 9, 2016
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. // output headers so that the file is downloaded rather than displayed...
by greg | Dec 29, 2015
Here is the code to run a sql file within a specified database. mysql -u DB_User -p DB_Name < sql_file.sql
by greg | Oct 28, 2015
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. UPDATE wp_options SET option_value = replace(option_value, ‘http://www.oldurl’,...
by greg | Apr 27, 2017
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...