Support » Fixing WordPress » Successful wpdb UPDATE returns 0 since 3.6.1 upgrade

  • Just upgraded to WP3.6.1. Since the upgrade I have had modify several of my plugins because $wpdb->update always returns a zero. This was causing several If statements to evaluate improperly, breaking the plugins.

    Also, I can no longer report how many records were updated, or anything else that requires a real number.

    I have manually checked the MySQL tables and found the data updated. I have used several echo and var_dump statements to validate that I was getting 0, not an error or other number, for successful updates.

    This has been consistent across all plugins that depend on the return value of $wpdb->update, but below is an example code:

    $upd = $prd_db->update($wpdb->users,$qry_user, array('user_login'=>($author->user_login)) );
       if ( $upd > 0){...code unable to run

    The same thing happens with $wpdb->query if the query is an update query:

    $results = $tax_db->query("UPDATE $db_opt SET option_value = '$opt_val' WHERE option_name = '$opt_name';");
    $success = ($results > 0) ? true : false;//always false since 3.6.1

    … And $wpdb->num_rows returned a 0 for the above example.

    Unfortunately, this is an intranet site, so I cannot provide links. If there is something else I can provide, please let me know.

    Is anybody else having this problem?

  • The topic ‘Successful wpdb UPDATE returns 0 since 3.6.1 upgrade’ is closed to new replies.