Get the post permalink within the loop but without additional DB query
-
Hi, I am looking to create a custom ‘directory’ page which will link to several thousands of posts. Because of the large number I am trying to limit the number of DB queries. I notice that to link to each post, I am calling get_permalink() and this is creating an extra DB query for each post.
Is there anyway to retrieve the post permalink without an additional query? I have tried passing the $post object which doesn’t seem to help. I’ve also had a look at the core function, and noticed passing the whole object along with a $post->filter = ‘sample’ value will avoid an additional get_post() call as per:
But it still seems to be causing an extra query. Any ideas?
The topic ‘Get the post permalink within the loop but without additional DB query’ is closed to new replies.