#3874 closed enhancement (invalid)
add returns in functions: the_time the_content the_permalink
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | low | |
Severity: | minor | Version: | 2.1 |
Component: | General | Keywords: | return function time content permalink |
Focuses: | Cc: |
Description
it would be great to include returns in this functions, i am using a couple of self written scripts (like a newsletter system, which is getting the data from a wp-installation) in which it would be helpful.
if there are no security reasons, why this would be a bad idea, i'd be really happy about it.
i'm using it since 2.0 without complications.
maybe you could use also include it in other functions?
function the_permalink() {
echo apply_filters('the_permalink', get_permalink());
return apply_filters('the_permalink', get_permalink());
}
function the_content($more_link_text = '(more...)', $stripteaser = 0, $more_file = ) {
$content = get_the_content($more_link_text, $stripteaser, $more_file);
$content = apply_filters('the_content', $content);
$content = str_replace(']]>', ']]>', $content);
echo $content;
return $content;
}
function the_time( $d = ) {
echo apply_filters('the_time', get_the_time( $d ), $d);
return apply_filters('the_time', get_the_time( $d ), $d);
}
Change History (4)
#2
@
16 years ago
oh didnt know that... sorry, i'll try it and remove the ticket, if its working ;-)
hehe, in future i'll only post in the trac, you get better help here, than in the support forum ;-)
Why? As you note, there are already functions to get_the_time(), get_the_permalink() etc. You can do what you want with them, including echoing out the results...
This isn't really necessary, except if you're desperate to manipulate the value after the filter but before it is echoed... But even if you wanted to do that, you could just use the 'post_link' filter instead and work with the return value of get_the_permalink.
Even if something like this was applied, it should be either/or, controlled by an argument, $return = false, the same as all the other template functions. Plus, you're applying the same filter twice, when you could just assign it to a variable.