Skip to main content
added 299 characters in body
Source Link
TheNiceGuy
  • 143
  • 1
  • 4

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?

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?

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?

Source Link
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?