Support » Plugin: Most Popular Posts Widget » Not optimized code

  • Hi.

    I tried to use your plugin, but it is making a lot of queries to DB and then I refused it.

    You have in the “functions.php” file the code like this:

    for(...) {
    	$wpdb->get_results("SELECT post_title FROM $posts_table WHERE ID = $post_number")

    Why do you making separate sql query in cycle?

    You can make just one query above like this:
    $wpdb->get_results("SELECT post_title FROM $posts_table WHERE ID IN ($postsIds) ")

    One general query to DB is more better than N queries.
    If you have a wish, please fix this trouble and your code.

Viewing 1 replies (of 1 total)
  • Plugin Author Piotr Pesta



    thanks for suggestion! Of course you are right about that, I’ll try to decrease number of queries with next update.


Viewing 1 replies (of 1 total)
  • The topic ‘Not optimized code’ is closed to new replies.