Skip to main content
2 of 2
added 299 characters in body
TheNiceGuy
  • 143
  • 1
  • 4

Hook into $wpdb

Is there a way to hook into the WPDB instance ($wpdb)?

What i basically want, is to execute a own function BEFORE the desired query get's executed.

Is this possible?

Additional question for comment to first answer:

    $query = $wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "test WHERE type = %s and ip = %s", $type, $ip_full_log);
    $fetch = $wpdb->get_results($query, ARRAY_A);

Would this parse the final query to my callback function?

TheNiceGuy
  • 143
  • 1
  • 4