[wp-hackers] post processing weirdness

Scott Merrill skippy at skippy.net
Sat Jun 25 20:48:38 GMT 2005

Scott Merrill wrote:
  > I made the following change to 
> at line 40:
>         if (0 == $id) {
>                 global $post;
>         } else {
>                 $post = & get_posts($id);
>         }
> That fixed my permalinks; and I'm still not seeing an increase in queries.

The above worked on my test blog, which is pretty vanilla. But it broke 
horribly on my real blog.  I tracked it down to the "Permalinks 
Redirect" plugin (http://scott.yang.id.au/2005/05/permalink-redirect/), 
and finally did this in wp-includes/template-functions-links.php:
if (0 == $id) {
      global $post;
} else {
      $post = & get_posts($id);
      $post = $post[0];

That didn't work ... Every permalink ended up pointing to my most recent 

So I went to look at get_posts().  Duh -- it accepts a query string 
formatted parameter!

So, are we in fact missing a get_post() function, which accepts the post 
ID of a post to fetch?

skippy at skippy.net | http://skippy.net/

gpg --keyserver pgp.mit.edu --recv-keys 9CFA4B35
506C F8BB 17AE 8A05 0B49  3544 476A 7DEC 9CFA 4B35

More information about the wp-hackers mailing list