Skip to content

Instantly share code, notes, and snippets.

@johnstonphilip
Last active December 6, 2022 16:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johnstonphilip/6ce2e02e071d6fb3c1b10dc64555b379 to your computer and use it in GitHub Desktop.
Save johnstonphilip/6ce2e02e071d6fb3c1b10dc64555b379 to your computer and use it in GitHub Desktop.
<?php
define('SHORTINIT', true);
require 'wp-load.php';
global $wpdb;
$post_id_to_get = 2;
$result = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->posts WHERE ID = %d", $post_id_to_get ) );
echo json_encode( $result );
die();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment