[wp-hackers] post processing weirdness

Scott Merrill skippy at skippy.net
Sat Jun 25 15:27:38 GMT 2005


Scott Merrill wrote:
> This is the offending line in wp-includes/template-functions-links.php:
> if ('' != $permalink && 'draft' != $post->post_status) {
> 
> What harm is there in generating a permalink for a draft post?
> 
> My _real_ question, though, is what is this?
>    $post = & get_post($id);
> Line 40 of wp-includes/template-functions-links.php.
> 
> I grepped for "get_post" and found several get_post_*(), and of course 
> get_posts(); but no get_post().  Is this simply a typo, or am I missing 
> something?
> 
> I suspect that the get_post() results in a no-op, leaving $post set to 
> the global $post object, which is still marked as Draft, even though 
> "Publish" has been set.

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

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