Combining two select posts from mysql – to get least viewed posts

This should be the SQL you’re looking for (off the top of my head, so may need some tweaking). “SELECT * FROM wp_posts LEFT JOIN wp_popularpostsdata ON (wp_posts.ID = wp_popularpostsdata.postid) LEFT JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id) LEFT JOIN wp_term_taxonomy ON (wp_term_relationships.term_taxonomy_id = wp_term_taxonomy.term_taxonomy_id) WHERE posts.post_type=”post” AND wp_term_taxonomy.term_id NOT IN (73) GROUP BY wp_posts.ID ORDER … Read more

how to run tests using different db connection

Changing the DB connection used by a WPDB object that already exists or passing it a mysqli instance is not possible. And if it was, it still wouldn’t work for other reasons. if you want to access a new database connection you need to create a new WPDB instance: $second_db = new WPDB( ‘dbuser’, ‘dbpassword’, … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)