Answer the question
In order to leave comments, you need to log in
How to connect to the database from a file in the root of the site?
You need to connect to the database from a file in the root of the site. But apparently WordPress doesn't see the wpdb class from the root. Only from template folders. How to solve this problem?
Answer the question
In order to leave comments, you need to log in
<?php
require_once __DIR__ .'/wp-load.php';
global $wpdb;
$sql=$wpdb->prepare("SELECT domain, path FROM $wpdb->blogs WHERE public=%s AND archived=%s AND deleted=%s",array(1,0,0));
$blogs=$wpdb->get_results($sql);
var_dump($blogs);
...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question