4 | | If you look closer at the code (in core & on wpse) you'll see that there's the filter name 'sample' required. Default is 'raw'. So, until you don't set the filter to 'sample' manually, you'll get an additional query. |
5 | | |
6 | | > You can also pass the whole $post object to get_permalink for no extra queries as get_post() accepts an object. |
7 | | |
8 | | Sure, but it won't be used until the object hasn't got the appropriate ''filter'' attached. |
| 4 | If you look closer at the code (in core & on wpse) you'll see that there's the filter name 'sample' required. Default is 'raw'. So, until you don't set the filter to 'sample' manually, you'll get an additional query and passing the object to the function won't help anything. Tested this in various cases - see also @scribu work around. |