Get data from 3rd table

I simplified your query, but wouldn’t something like this accomplish it? SELECT * FROM $wpdb->posts AS p LEFT JOIN $wpdb->postmeta AS pm ON p.ID = pm.post_id LEFT JOIN users AS u ON pm.meta_value = u.user_id WHERE pm.meta_key = ‘user_id’ AND post_status=”publish” ORDER BY p.ID DESC LIMIT 50;

MYSQL Join on meta key value?

You can update just joining both table on comparing same userid. like: update t1 join t2 on t1.user_id = t2.user_id set t1.meta_value = t2.desc;

XML RPC post produces immediate revision with odd post_date_gmt

Alright. I think I cracked it. <dateTime.iso8601>20140111T20:39:15</dateTime.iso8601> Should be: <dateTime.iso8601>20140111T20:39:15Z</dateTime.iso8601> Looks like the toolkit I was using didn’t quite implement iso8601 perfectly (or wordpress isn’t – not sure). I’m using Node WordPress and tracked down that it uses the module Node XML RPC to actually send the XML RPC. This seems to be where the … Read more

optimise SQL wordpress call

The query itself may need to be optimized (SQL is not my speciality, though). However, don’t forget you can store the results of an expensive operation in cached memory. WordPress offers a Transients API to make things easy. Here’s a quick example: // Try to load the value from cache $transient_key = ‘my_query’; $value = … Read more

wp_postmeta – lot of meta fields

Those are not Core entries so far as I know. That means that a plugin or a theme has inserted them. Since I don’t know which plugin or theme it is, or whether you are still using that plugin/theme, I can’t say whether you should delete the entries. If you are still using the plugin … Read more

Making CURDATE() recognize current_time()

$current_time = current_time(‘mysql’); $querystr = ” SELECT * FROM {$wpdb->prefix}usermeta WHERE meta_key=’bday_unix’ AND DATE_ADD( from_unixtime(meta_value), INTERVAL YEAR( ‘{$current_time}’ ) – YEAR( from_unixtime( meta_value ) ) YEAR ) BETWEEN ‘{$current_time}’ AND DATE_ADD( ‘{$current_time}’, INTERVAL 30 DAY )”; Should work, I think.