MySQL Forums
Forum List  »  Newbie

Batch edit a table using sql
Posted by: Paul Smith
Date: August 13, 2014 12:46PM

I'm trying to add a shortcode to my content in my wordpress database using sql query but am not having much luck.

Here is what I've tried to date:

These two were unsuccessful.
UPDATE wp_posts SET post_content = replace(post_content, '[caption]New Caption[/caption]');

UPDATE wp_posts SET post_content = insert(post_content, '[caption]New Caption[/caption]');

This one replaced all the content with my shortcode instead of adding it to the end of the content like I want.

UPDATE `my_website`.`wp_posts` SET `post_content` = 'Welcome to WordPress. This is your first post. Edit or delete it, then start blogging! [caption]New Caption[/caption]' WHERE `wp_posts`.`ID` = 1;

Any help would be greatly appreciated.

Options: ReplyQuote


Subject
Written By
Posted
Batch edit a table using sql
August 13, 2014 12:46PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.