Tag Info

Hot answers tagged

2

You want the query to look like this: SELECT email FROM wp_my_users WHERE email = 'mail@example.com' instead of this: SELECT email FROM 'wp_my_users' WHERE email = 'mail@example.com' So try to construct your query with: $sql = "SELECT email FROM {$my_table_name} WHERE email = %s"; $result = $wpdb->get_var( $wpdb->prepare( $sql, $email_address ...


1

First, you're using prepare() wrong. Should be this: $wpdb->prepare("SELECT Active FROM testers WHERE user_id = %s", $user_id) If you have any debugging enabled, it will throw an error from your code. Which may make your location header not work properly. Second, the get_var() function indeed returns null when there are no results. Third, setting a ...


1

Why not use get_comments(), instead of trying to roll your own with $wpdb? function display_sitewide_comments() { $sites = wp_get_sites(); $network_comments = array(); $max = 20; foreach( $sites as $site ) { switch_to_blog( $site->blog_id ); $args = array( 'number' => $max, 'status' => ...



Only top voted, non community-wiki answers of a minimum length are eligible