N
N
Newn2018-03-22 13:51:24
PHP
Newn, 2018-03-22 13:51:24

How to include wordpress global variables in your php?

Good afternoon. I wrote my own functionality in php and I want to use it on a wordpress site as a separate page. But here's the problem, I can't get the data that I need from the wordpress database. What do I need to register and connect so that I can pull any data from wordpress into my script?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
E, 2018-03-22
@Newn

<?php
define( 'WP_USE_THEMES', false );
define( 'SHORTINIT', true );
require_once $_SERVER['DOCUMENT_ROOT'] . 'wp-load.php';

global $wpdb;
?>

wpdb

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question