[wp-hackers] post processing weirdness

Scott Merrill skippy at skippy.net
Sat Jun 25 18:59:42 GMT 2005

On Sat, 25 Jun 2005 11:31am, I wrote:
 > Follow-up to myself: I have edited template-functions-links.php, and
 > replaced get_post() with get_posts().  The correct cruft-free
 > permalink is now generated.  So I guess it _is_ a simple typo, for
 > which I'll now file a bug.  =)

Mark Jaquith responded:
> I think this is the bug that has been plaguing WordPress and me for 
> months.  You remember the bug whereby if you created a draft and then 
> published, your pingbacks would be sent out with crufty ?p= URIs?  If 
> you honestly fixed that bug, I owe you a beer.  I spent about 2 hours 
> trying to fix that bug and failing.

Hang on to that beverage.

I reported my findings to the guy who originally reported the problem to 
me.  He went a step further in his testing and investigation, and 
reported this:

 > I made the change you suggested, and immediately refreshed the index
 > page of my blog to see if there were any effects.  Sure enough, the
 > load of my index page went from generating 50 queries in 0.4 seconds,
 > to 251 queries in 11.7 seconds.  The time is mostly irrelevant, but
 > the high number of queries concerned me.
 > I'm going to take a stab at fiddling with your code later today to
 > see if I can come up with anything, but I'm thinking there's got to
 > be a relatively easy check that can be instituted, or other variable
 > that can be used relative to a $post that has the information we're
 > after.
 > By the way, a little more testing showed me that the problem doesn't
 > actually occur until a post has been saved as a draft *twice*.  The
 > initial saving of a post puts it into 'draft' status, but doesn't
 > actually create the post slug.  If that post is recalled as a draft,
 > and then saved again, the post slug gets created, which I think is
 > what's actually "breaking" the get_permalink() call.

I didn't experience the same problem with the number of queries, but all 
my permalinks _did_ break, reverting to the current date with no post 
title.  =(

So the problem is a little more subtle perhaps than I understood it to be.

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