Properly handle nested arrays in wp_list_filter(). Props scribu, SergeyBiryukov. fixes #16137
git-svn-id: http://svn.automattic.com/wordpress/trunk@18606 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
19c3608dcc
commit
978a5984b4
|
@ -3198,7 +3198,14 @@ function wp_list_filter( $list, $args = array(), $operator = 'AND' ) {
|
|||
$filtered = array();
|
||||
|
||||
foreach ( $list as $key => $obj ) {
|
||||
$matched = count( array_intersect_assoc( (array) $obj, $args ) );
|
||||
$to_match = (array) $obj;
|
||||
|
||||
$matched = 0;
|
||||
foreach ( $args as $m_key => $m_value ) {
|
||||
if ( $m_value == $to_match[ $m_key ] )
|
||||
$matched++;
|
||||
}
|
||||
|
||||
if ( ( 'AND' == $operator && $matched == $count )
|
||||
|| ( 'OR' == $operator && $matched <= $count )
|
||||
|| ( 'NOT' == $operator && 0 == $matched ) ) {
|
||||
|
|
Loading…
Reference in New Issue