Tag Info

Hot answers tagged

1

Trivial! $wpdb->last_query will hold it. :) For more extensive log you might want to define SAVEQUERIES constant to true in configuration. Full log then will be available in $wpdb->queries. It's off by default for performance reasons.


1

You can join to the comments table and use get_the_ID(): // set the meta_key to the appropriate custom field meta key $meta_key = 'rating_total'; $ratingtotals = $wpdb->get_var( $wpdb->prepare( " SELECT sum(cm.meta_value) FROM $wpdb->commentmeta AS cm JOIN $wpdb->comments AS c ON (c.comment_ID = cm.comment_id) ...


1

Short answer, no. WPDB is a class that's been around for a while (back when WP used to support PHP 4), and lacks a lot of features PHP5 drivers offer, including parameter binding. As you mentioned, wpdb::insert is the closest you can get to your original code: $wpdb->insert( 'importtest', array( 'id' => $ID, 'area' ...


1

You can try this with WP_User_Query instead: $args = array ( 'meta_query' => array( array( 'key' => 'newsletter', 'value' => 'true', ), array( 'key' => 'account', 'value' => 'false', ), ), 'date_query' => array( array( ...


1

WordPress is heavy out-of-the-box. If you only need the database, you'd be so much better off using mysqli or PDO and just connecting directly. Not to mention (in my opinion) PDO beats hell out of wpdb anyway, win win. the idea is to make use of the DB defines in wp-config.php without needing to store the username/password somewhere else Create ...


1

And there is your issue — WordPress does need to understand URL. Otherwise it is indeed 404 because it doesn't correspond to anything WP “knows”. You need to create that understanding, for example by using Rewrite API. Also since your data is external and isn't really a part of WP context, you will probably need to override 404 decision as well in the end.



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