Speed optimization of $wpdb->get_results
-
Hello,
I’m using this code to generate all my custom field values from all posts for custom field named “autor”.
<?php $autor = $wpdb->get_results("SELECT meta_value AS autor FROM wp_posts, wp_postmeta WHERE post_status = 'publish' AND meta_key = 'autor' GROUP BY meta_value ORDER BY meta_value") ?> <ol> <?php foreach( $autor as $autori ) : ?> <div class="autor"> <li><a href="https://simplynote.me/?s=<?php echo $autori->autor ?>"><?php echo $autori->autor ?></a></li> </div> <?php endforeach ?> </ol>
It works okey, but the problem is that it takes a couple of seconds more (like, the page is loading for 5-10 seconds) for server to load that particular page (www.simplynote.me/autori). Is there any way to optimize this request?
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Speed optimization of $wpdb->get_results’ is closed to new replies.