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

denis at semiologic.com denis at semiologic.com
Wed Apr 13 00:07:17 GMT 2005


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...

has anyone programmed a function I could use that would be more appropriate?

i'd be looking for something like:

function get_permalink_no_db( $post )
{
  if ( /* no need to query db */ )
    return /* the permalink with no db access */
  else
    return get_permalink()
}

and:

function get_category_link_no_db( $cat )
{
  if ( /* no need to query db */ )
    return /* the permalink with no db access */
  else
    return get_category_link()
}

--
Denis
http://www.semiologic.com

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.


More information about the wp-hackers mailing list