/ Published in: PHP
So, you define a couple of fake funcs and require WP database config, after this you can require wp-db.php, create new wpdb and use it independency of WP for your ajax actions.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php //fake funcs function is_multisite() {return true;} function apply_filters($tag, $value) { return $value; } function wp_load_translations_early() {} function __($text) { return $text; } // $doc_root = $_SERVER['DOCUMENT_ROOT']; require $doc_root . '/db-config.php'; require $doc_root . '/wp-includes/wp-db.php'; //Oh, Yeah! $wpdb = new wpdb(DB_USER, DB_PASSWORD, DB_NAME, DB_HOST); ?>