[wp-hackers] get_permalink() creates huge amounts of db access with plugins

Ryan Boren ryan at boren.nu
Wed Apr 13 00:30:57 GMT 2005

On Wed, 2005-04-13 at 00:07 +0000, denis at semiologic.com wrote:
> hello,
> while programing a couple of plugins, i've been using things such as:
> apply_filters('the_permalink', get_permalink($cur_post->ID));
> apply_filters('the_permalink', get_category_link($cur_cat->cat_ID) );
> it initially occured to me it would be nice to use them rather than hard coding
> the permalinks.
> but only initially. i eventually found myself wondering how a silly blog page
> could require 40+ queries...

Is this with 1.5.1?  The caching has been changed a bit in 1.5.1.  You
shouldn't see multiple queries, especially not with categories since we
query all categories up front.  You might see multiple queries if your
plugin is pulling in posts that are not part of the main query.  The
plugin can use update_post_caches() or update_post_cache() to avoid
multiple queries.


More information about the wp-hackers mailing list