WordPress functions aren’t being recognised by script
-
From a particular page, I have a form that sends data to a JS, which then sends a $_POST request to a file called post.php
post.php accesses a database (a different database to the WP), and then outputs the data back to the JS script, which is then written to the screen.
It’s very simple AJAX talking to a server-side database.
I’m trying to use wpdb. The problem is that the post.php script doesn’t recognise WordPress functions. I’ve tried require() and require_once() with wp_config.php, wp_blog_header.php, and wp_load.php (this last one is recommended by the codex article on wpdb).
The require() isn’t throwing any errors, but the wordpress functions are still unrecognised.
Any help with this? Or any idea how I can interact with a database with JS in a let clumsy way? I found that WP would muck around with $_POST when I tried to write this as a plugin. I need this finished by the weekend, and I’m scraping the barrel for any hack that will work. No longer have time to do it properly.
The topic ‘WordPress functions aren’t being recognised by script’ is closed to new replies.