Skip to content

Instantly share code, notes, and snippets.

@allysonsouza
Created November 28, 2018 21:40
Show Gist options
  • Select an option

  • Save allysonsouza/83fb0097d52d1ec2fa5ad0d9e3cbdc41 to your computer and use it in GitHub Desktop.

Select an option

Save allysonsouza/83fb0097d52d1ec2fa5ad0d9e3cbdc41 to your computer and use it in GitHub Desktop.
Export WordPress XML content acessing this file. It supports the exports of more posts than it's supported trough the panel with the same server resources.
<?php
include 'wp-config.php';
include 'wp-admin/includes/export.php';
 
ob_start();
export_wp();
$file = ob_get_contents();
ob_end_clean();
 
$fh = fopen("wordpress-" . date('Y-m-d') . ".xml", 'w');
fwrite($fh, $file);
fclose($fh);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment