Created
          July 16, 2013 20:27 
        
      - 
      
- 
        Save frederickding/6012347 to your computer and use it in GitHub Desktop. 
    Search for all <wp:post_type> in a WXR file
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | <?php | |
| $input_file = '/path/to/wxr.wordpress.2013-07-16.xml'; | |
| $file = simplexml_load_file($input_file); | |
| $output = fopen($input_file . '.txt', 'w'); | |
| // find all instances of <wp:post_type> | |
| $matches = $file->xpath('//wp:post_type'); | |
| foreach($matches as $match) { | |
| // write out the contents | |
| fwrite($output, $match->__toString() . "\n"); | |
| } | |
| fclose($output); | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment