• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 59
  • Last Modified:

Wordpress Query

I am writing an AJAX call with Wordpress.  I have a simple query and for some reason it is not working.   The result of the following query is "access_registration" and I have written it that way so it always passes.  However, it the Console (Chrome) the JSON I get back is:
Am I running the query correctly?

function checkPassword(){
    global $wpdb;

$return = "";
$return = $_POST['regpass'];

$result = $wpdb->get_results( "SELECT user_login FROM wp_dd6xmx2by0_users WHERE ID = '8'");
if($result == 'access_registration') {
    $return = "GO";
} else {
    $return = 'NO GO';
add_action('wp_ajax_checkPassword', 'checkPassword');
add_action('wp_ajax_nopriv_checkPassword', 'checkPassword');

Open in new window

1 Solution
Terry WoodsIT GuruCommented:
Have you based your javascript code on the example in the documentation for wp_send_json? https://codex.wordpress.org/Function_Reference/wp_send_json
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Train for your Pen Testing Engineer Certification

Enroll today in this bundle of courses to gain experience in the logistics of pen testing, Linux fundamentals, vulnerability assessments, detecting live systems, and more! This series, valued at $3,000, is free for Premium members, Team Accounts, and Qualified Experts.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now