Geographical proximity query using post_meta

Oh dear, that was extremely obvious – there was a missing closing bracket! Here is the working query. SELECT ID, ( 6371 * acos ( cos ( radians( 35.665833 ) ) * cos( radians( latitude.meta_value ) ) * cos( radians( longitude.meta_value ) – radians( 139.731111 ) ) + sin ( radians(35.665833 ) ) * sin( … Read more

Split database on large site?

I had a similar issue on a website with ~100k rows in wp_posts and ~500k in wp_postmeta. Truth is WordPress have some really slow queries in the admin when you start to have a lot of posts. The best way to find the bottleneck is to use the Debug Bar plugin. You will probably find … Read more

MySQL – How to combine data from two tables into one?

Syntax The issue with your WordPress approach is the get_var calls used to get the subscriber id and interest name. get_var is intended to get just a variable from the database like the number of rows in the table or sum of a numeric column in the table, see the WordPress Codex What your looking … Read more

Insert multiple checkbox values

I solve it. public function insertionRow($id){ global $wpdb; $wpdb->query(“INSERT INTO wp_choix_attributs_liste (att_id) VALUES (“.$id.”);”); } In my html with the checkbox. if(isset($_POST[‘sub’])) { foreach ($_POST[‘choixP’] as $id) { self::insertionRow($id); } }