Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have a question regarding my site, tablified.com. I need to change a line of code on ALL of my posts. Within each post, there is a certain line of code that needs to be altered. This code is this:

[a href="https://market.android.com/details?id=COM.NAMEOFAPP.EXAMPLE>< src="http://tablified.com/wp-content/uploads/2011/07/androidicon.png" alt="" title="Click to Download from Android Market" width="300" height="48" class="alignnone size-full wp-image-4507" /]

This is found at the bottom of every post. As you know, this simply displays a clickable picture that takes the user to another page. For all 376 posts, 95% of this code is the same. The only thing that differs between posts is:

COM.NAMEOFAPP.EXAMPLE

that line is specific for every app on the official Android Market. I have found a new plugin that will allow me to display a widget at the bottom of the post with a nice picture and link to the official Android Market. To make a long story short, that entire line of code needs to be edit to look like this:

[app]COM.NAMEOFAPP.EXAMPLE[/app]

All I did was remove the first part of the code:

<a href="https://market.android.com/details?id= 

and replace it with [app] and then replace the second half of the code

">< src="http://tablified.com/wp-content/uploads/2011/07/androidicon.png" alt="" title="Click to Download from Android Market" width="300" height="48" class="alignnone size-full wp-image-4507" /></a>

with [/app] so now you are left with

[app]COM.NAMEOFAPP.EXAMPLE[/app] 

of course with the proper name of that particular app in between the [app][/app]. My question is, what is the quickest way to accomplish this? If I export all the posts to a XML file, I can use a text editor to make the changes. But what will happen once I import this file back into Wordpress? Will it overwrite the previous posts? Will it create new ones? What will happen to the screenshots with each of those posts? I am using a theme that doesn't actually attach the image to post, meaning if I export it, the pictures wont be there. Will they be lost? Please let me know if you can help me with this. Thank you so much for your time. I hope everything made sense. The fix seems simple, but I am not sure of the outcome.

Ayman

share|improve this question

3 Answers 3

Search RegEx is a good plugin to be able to search and replace with Grep through all posts and pages.

share|improve this answer

You can do this in number of ways, but easiest would be to use one of tools available. For example Serialized PHP Search Replace Tool.

Be sure to create backup of your database before you start to make any changes.

share|improve this answer

Check out the Search and Replace Plugin. I think it will do what you want.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.