I have exported all my content to WordPress XML file via WordPress>Tools>Export as I needed to edit 300 posts at a time. Now, my concern is how to re import the file to override the default one? By re-importing the file via WordPress Tools it does only import new posts, so it's not adapted to that particular case without breaking my site/database. I need to find a way to re import the file.

Any suggestion is appreciated.

  • Have you considered just doing it in a different way? What is your issue with editing in first place?
    – Rarst
    Jan 9 '14 at 16:19
  • Do you mean editing 200 to 300 posts html source code on WordPress dashboard by going to every single post? Jan 9 '14 at 16:29
  • What are you trying to edit in first place? Jan 9 '14 at 16:48
  • I mean there are tools for changing data in database, etc. Clearly import/export approach is problematic for your use case, but it's hard to say what would work better without understanding of what your use case is precisely.
    – Rarst
    Jan 9 '14 at 16:57
  • What I need to edit is the source Html code of each post. For example removing the 'text-align: justify' inside the blockquote, correcting some duplicate tags, removing old shortcodes, editing some characters from uppercase to small caps, etc... Jan 9 '14 at 17:03

What do you need to edit and why can't you edit in the WP editor?

Can you use Search RegEx? It's a plugin to search and replace with grep and regular expressions through content.

If you need to develop a regex search string to find certain content, check https://stackoverflow.com/questions/tagged/regex

  • I'm changing of template and need to edit the source code for each post to match with the new template. Jan 9 '14 at 17:04
  • That plugin will edit all posts at once, with grep, if needed. Jan 9 '14 at 17:09
  • I need to remove text align justify inside all the blockquote + every tag like <i> or <em> and remove the closing tags </p>. It's not just a search/replace process, I'm not sure this plugin will do the trick. Using Notepad++ you can do the job in one click for all the template. Jan 9 '14 at 17:16
  • Also, need to find a way to remove extra/redundant formatting tags Jan 9 '14 at 17:26
  • Yes, it will. You can do all that with grep. But grep is not specific to WordPress. Check stackoverflow.com/questions/tagged/regex Jan 9 '14 at 18:39

If you really need to do this, then you'll have to delete the existing posts completely - ie 'Bin' them, and then Empty the bin/trash. You'll then be able to import the WXR file via Tools | Import.

  • Yes, Anu makes an important point that needs highlighting: in my experience, if you do not empty (those posts from) the trash, WP sees those posts as still existing, and thus will not import them. Jan 28 '21 at 3:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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