[wp-trac] [WordPress Trac] #12723: apply_filters_ref_array bug
WordPress Trac
wp-trac at lists.automattic.com
Wed Mar 31 21:20:23 UTC 2010
#12723: apply_filters_ref_array bug
-------------------------------------+--------------------------------------
Reporter: jfarthing84 | Owner: westi
Type: defect (bug) | Status: closed
Priority: highest omg bbq | Milestone:
Component: Plugins | Version: 3.0
Severity: blocker | Resolution: invalid
Keywords: has-patch tested commit |
-------------------------------------+--------------------------------------
Changes (by westi):
* status: assigned => closed
* resolution: => invalid
* milestone: 3.0 =>
Comment:
Your filters are not written correctly.
A filter hooked into a WordPress filter must return something to be passed
back out.
By default the first argument passed to apply_filters /
apply_filters_ref_array is returned unless a function is hooked in.
If something is hooked in then the result of that function is returned
instead.
If there are a number of filters then the result of one gets passed to the
next as an argument.
Your examples should be:
{{{
function posts_where_filter_one($where) {
global $wpdb;
$where .= " AND $wpdb->posts.post_type = 'post'";
return $where;
}
add_filter('posts_where', 'posts_where_filter_one');
function posts_where_filter_two($where) {
global $wpdb;
$where .= " AND $wpdb->posts.post_status = 'publish'";
return $where;
}
add_filter('posts_where', 'posts_where_filter_two');
}}}
Closing as invalid
--
Ticket URL: <http://core.trac.wordpress.org/ticket/12723#comment:10>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list