Answer the question
In order to leave comments, you need to log in
How to get a post from another wordpress script?
I implement an ajax cart that connects to the database and gets the id of the goods in the current user's cart, so you need to get the title, thumbnail and other post data by Id.
As I understand it, you need to include files that form a request and define the concept of $post.
Answer the question
In order to leave comments, you need to log in
// indicate that we need a minimum from WP
define('SHORTINIT', true);
// load the WordPress environment
// WP does some checks and only loads the essentials to connect to the database
require_once( $_SERVER['DOCUMENT_ROOT'] . '/wp-load.php' );
global $wpdb;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question