Skip to content

Instantly share code, notes, and snippets.

@nagayama
Created June 12, 2015 07:18
Show Gist options
  • Save nagayama/48adaace6e2b113ff724 to your computer and use it in GitHub Desktop.
Save nagayama/48adaace6e2b113ff724 to your computer and use it in GitHub Desktop.
wordpress batch script
<?php
$_SERVER = array(
"HTTP_HOST" => "localhost",
"SERVER_NAME" => "localhost",
"REQUEST_URI" => "/",
"REQUEST_METHOD" => "GET"
);
define('WP_USE_THEMES', true);
require_once("html/wp/wp-load.php");
$posts = get_posts(array(
"posts_per_page" => -1,
));
foreach($posts as $post) {
var_dump($post);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment