Changing WooCommerce Text
Weird WPDB->Prepare Error

The WPDB->Prepare error was a red herring; I wasn’t using WPDB->Prepare anywhere


the other day I was attempting to add some information to my site’s WordPress database from a JSON file, when I received a ton of ‘$wpdb->prepare’ errors. Now normally when I see these kinds of errors it means I haven’t supplied the required variable placeholders, or I haven’t done so correctly. For example, here’s an example of an incorrect usage of $wpdb->prepare:

 $wpdb->prepare("SELECT * FROM $table  LIMIT 1")

The ‘1’ in that line of code should be replaced with the ‘%d’ placeholder, and there should be a second argument that defines the placeholder, like so:

 $wpdb->prepare("SELECT * FROM $table  LIMIT %d", 1)

Upon execution, the ‘%d’ gets replaced with a ‘1’. To make this work with a string instead of an integer, use ‘%s’ instead. (NOTE: the table name in the prepare statement can be a variable and does not need to use a placeholder).

So naturally, I went looking for any instances of $wpdb->prepare… the only problem was, I hadn’t used $wpdb->prepare anywhere in my code whatsoever.

After more time than I’d like to admit, I finally figured it out – in my $wpdb->insert statement, I had specified a string variable as an integer variable, which ended up throwing $wpdb->prepare errors, oddly enough. I assumed that by using a ‘%d’ placeholder in my $wpdb->insert statement, the data formatting would be taken care of. Guess that’s what I get for assuming. Here’s the offending code:

$file = fopen(plugin_dir_path( __FILE__ ).'assets/json/company_names_formatted_backup.json',"r");
    //Output a line of the file until the end is reached
    $line = fgets($file);
        $string = str_replace('\n', '', $line);
        $string = rtrim($string, ',');
        $string = "[" . trim($string) . "]";
        $json = json_decode($string, true);
        $matchingcompid = $json[0]['matchingcompid'];
        $companyname = $json[0]['companyname'];
        $table_name = $wpdb->prefix.'wpgamelist_jre_list_company_names';
                      'matchingcompid' => $matchingcompid, 
                      'companyname' => $companyname,
        $line = fgets($file);

Specifically, the $matchingcompid variable in line 9 is a string variable, and needed to be an integer. So, I simply cast $matchingcompid to an integer, like so:

$matchingcompid = (int)$json[0]['matchingcompid'];

and everything worked just as expected. Problem solved.

Updated Woocommerce shipping text
Changing WooCommerce Text
Updated Woocommerce shipping text

Updated WooCommerce Checkout Text


I had a client e-mail me about an issue with her WooCommerce checkout page. She was contacted by a customer whose billing address was in Canada, with a shipping address here in the United States. The customer found the second part of the checkout page where she could input her actual shipping address just fine, but right above this section was a checkbox (checked by default), which read, “Shipping Address Same As Billing Address“.

When the customer unchecked the box, the “ship to a different address” form disappeared. It re-appeared when checked again. In my mind, and apparently the customer and client’s minds as well, that functionality was completely backwards.

I decided the functionality (displaying/hiding the form upon checking the checkbox) was good as it was, but the text needed to be changed to something more intuitive, like, “Check Box To Ship To A Different Address“.

I decided the best way to go about this was to place a PHP function I found elsewhere online in my client’s Child Theme, that would allow us to easily change any default WooCommerce text we want now and in the future. Here’s the code:

add_filter('gettext', 'custom_strings_translation', 20, 3);

function custom_strings_translation( $translated_text, $text, $domain ) {
    switch ( $translated_text ) {
        case 'Shipping address same as billing address' :
            $translated_text = __( 'Check Box to Ship to a Different Address', '__x__' );
    return $translated_text;

Simply place the text you want changed as the case in the switch function, and place the text you’d rather have in the next line, and then you’re done!

Don't touch WP-Config!
Migrate to GoDaddy Managed WordPress Manually
Don't touch WP-Config!

Don’t touch WP-Config!

Wanna waste about 2 hours like I did trying to accomplish what’s supposed to be maybe a 30-minute job? Then by all means, replace the wp-config.php file that GoDaddy creates when a user signs up for their Managed WordPress Hosting account!

Not having migrated too many WordPress websites manually, I spent some time reading up on how to do so before pulling the trigger and beginning the process. The consensus across the internet (roughly), seemed to be:

1. Back up all existing WordPress files
2. Back up existing database
3. Edit the database file if the URL will be different from the original
4. Drop the entire GoDaddy database via PhpMyAdmin
5. Upload your old database to GoDaddy’s
6. Upload the old wp-content folder to GoDaddy, replacing the current one
7. Replace/update your wp-config.php file with your new GoDaddy database credentials

See how number 7 above is struck-through and in red? DON’T DO IT! It took me forever to randomly stumble across this article (only after entering the correct Google search terms… this article definitely didn’t show up via searching through GoDaddy’s articles on their own site):

The issue was with the database host name. Instead of the typical ‘localhost’, or even the IP address of your new site, GoDaddy uses a special, unique hostname. The one that worked for me was ‘’, as in:

/** MySQL hostname */
define('DB_HOST', '');

As far as I can tell, this information isn’t listed ANYWHERE within your GoDaddy account, so, whatever you do, don’t touch the GoDaddy-generated wp-config.php file for your managed WordPress account.

Clearing Cron Jobs Via PhpMyAdmin
Clearing WordPress Cron Jobs Via PhpMyAdmin
Clearing Cron Jobs Via PhpMyAdmin

Clearing WordPress cron Jobs Via PhpMyAdmin

Just in case you’ve ever wondered how to clear, oh, I don’t know, maybe 537 cron jobs that may or may not have been accidentally scheduled by your own custom WordPress plugin, here’s how to do it:

– Log into PhpMyAdmin
– Click on the database in question
– Click on the ‘SQL’ tab
– Paste this code, replacing the ‘5ea_options’ with the name of the options table of your particular wordPress installation:

UPDATE 5ea_options SET option_value = '' WHERE option_name = 'cron';

– Click ‘Go’
– That’s it, all cron jobs (expect for the ones WordPress itself has created) will be removed!