New book on WordPress Theme Development: WordPress Themes In Depth
2007 Jul 25
Daily Archive

MySQL Magic: Find and Replace Data

Recently, I needed to find and replace all instances of “http://website” in the wp_comments table of the WordPress database. Fortunately, SQL provides a simple way to find and replace data with its wonderful UPDATE function. General Example Using the SQL UPDATE command is straightforward. Here is the general syntax: UPDATE table_name SET field_name = replace( field_name, ‘string_to_find’, ‘string_to_replace’ ) ; Simply replace the table_name and both instances of field_name with your specific information, and then edit string_to_find, and string_to_replace with the desired values. This is pretty standard stuff, but it is always a good idea to backup your database before […] Read more »

Another Mystery Solved..

Recently, after researching comment links for an upcoming article, I realized that my default <input /> values were being submitted as the URL for all comments left without associated website information. During the most recent site redesign, I made the mistake of doing this in comments.php: … <input class=”input” name=”url” id=”url” value=”[website]” onfocus=”this.select();” type=”text” tabindex=”3″ size=”44″ maxlength=”133″ alt=”website” /> … Notice the value=”[website]” attribute? It seemed like a good idea at the time — I even threw in a nice onfocus auto-highlighting snippet for good measure. I ran the form with this in place for around eight weeks before finally […] Read more »

Latest Tweets USP Pro v1.9 now available, many great new features: plugin-planet.com/usp-pro-vers… #wordpress #plugin