[wp-hackers] ob_start - good or bad?
otto at ottodestruct.com
Thu Apr 23 09:35:12 GMT 2009
Well, there's already a get_edit_post_link() function, so why not use
that instead? Okay, so it doesn't return all the a href stuff, but
that's easy to duplicate.
In general, it's a bad idea to use output buffering unless there's no
other way to do it. In the case of the given code, there's definitely
another way to do it.
Sent from Memphis, Tennessee, United States
On Thu, Apr 23, 2009 at 4:02 AM, Simon Wheatley
<simon at sweetinteraction.com> wrote:
> Hullo hivemind,
> I'm find myself writing various pieces of code using this kind of
> pattern recently, does it carry any downsides?
> protected function get_edit_post_link( $link = 'Edit This', $before =
> '', $after = '' )
> ob_start ();
> edit_post_link( $link, $before, $after );
> $output = ob_get_contents ();
> ob_end_clean ();
> return $output;
> Thanks in advance.
> Sweet Interaction Ltd is Registered in England/Wales, no. 6610741
> Registered office: 7 Malton Av, Manchester, M21 8AT
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
More information about the wp-hackers