[wp-hackers] Useless Filter

Austin Matzko if.website at gmail.com
Tue Feb 17 17:20:46 GMT 2009

On Tue, Feb 17, 2009 at 11:07 AM, Nathan Rice <ncrice at gmail.com> wrote:
> $output .= $indent . '<li class="' . $css_class . '"><a href="' .
> get_page_link($page->ID) . '" title="' .
> attribute_escape(apply_filters('the_title', $page->post_title)) . '">' .
> $link_before . apply_filters('the_title', $page->post_title) . $link_after .
> '</a>';
> As you can see, the title is generated using the $page->post_title object.
>  But since the the_title filter doesn't have any way of passing the
> $page->post_title into a filter, this filter ends up being useless.  At
> best, you can use a function to output something, but since it doesn't have
> a way to pass a variable into the filter function, the result is EXACTLY the
> same no matter where the the_title filter is used (which is pretty much
> everywhere a post/page title is called).

$page->post_title is passed to whatever are the callbacks for
"the_title"; for default WordPress, that includes wptexturize(),
trim(), and convert_chars().  So the result is not exactly the same as
not using the filter, for those strings that will be modified by one
of those functions.

However, I think you're right that passing the ID of the page as a
second argument would be a helpful enhancement.

More information about the wp-hackers mailing list