Ticket #7326: 7326.diff
| File 7326.diff, 5.0 KB (added by ryan, 4 years ago) |
|---|
-
wp-includes/post.php
451 451 'order' => 'DESC', 'include' => '', 452 452 'exclude' => '', 'meta_key' => '', 453 453 'meta_value' =>'', 'post_type' => 'post', 454 'post_parent' => 0 454 'post_parent' => 0, 'suppress_filters' => true 455 455 ); 456 456 457 457 $r = wp_parse_args( $args, $defaults ); -
wp-includes/query.php
837 837 if ( !isset($q['caller_get_posts']) ) 838 838 $q['caller_get_posts'] = false; 839 839 840 if ( !isset($q['suppress_filters']) ) 841 $q['suppress_filters'] = false; 842 840 843 if ( !isset($q['post_type']) ) { 841 844 if ( $this->is_search ) 842 845 $q['post_type'] = 'any'; … … 1367 1370 1368 1371 // Apply filters on where and join prior to paging so that any 1369 1372 // manipulations to them are reflected in the paging by day queries. 1370 $where = apply_filters('posts_where', $where); 1371 $join = apply_filters('posts_join', $join); 1373 if ( !$q['suppress_filters'] ) { 1374 $where = apply_filters('posts_where', $where); 1375 $join = apply_filters('posts_join', $join); 1376 } 1372 1377 1373 1378 // Paging 1374 1379 if ( empty($q['nopaging']) && !$this->is_singular ) { … … 1400 1405 $cgroupby = ''; 1401 1406 } 1402 1407 1403 $cjoin = apply_filters('comment_feed_join', $cjoin); 1404 $cwhere = apply_filters('comment_feed_where', $cwhere); 1405 $cgroupby = apply_filters('comment_feed_groupby', $cgroupby); 1408 if ( !$q['suppress_filters'] ) { 1409 $cjoin = apply_filters('comment_feed_join', $cjoin); 1410 $cwhere = apply_filters('comment_feed_where', $cwhere); 1411 $cgroupby = apply_filters('comment_feed_groupby', $cgroupby); 1412 } 1406 1413 1407 1414 $this->comments = (array) $wpdb->get_results("SELECT $distinct $wpdb->comments.* FROM $wpdb->comments $cjoin $cwhere $cgroupby ORDER BY comment_date_gmt DESC LIMIT " . get_option('posts_per_rss')); 1408 1415 $this->comment_count = count($this->comments); … … 1422 1429 1423 1430 // Apply post-paging filters on where and join. Only plugins that 1424 1431 // manipulate paging queries should use these hooks. 1432 if ( !$q['suppress_filters'] ) { 1433 $where = apply_filters('posts_where_paged', $where); 1434 $groupby = apply_filters('posts_groupby', $groupby); 1435 $join = apply_filters('posts_join_paged', $join); 1436 $orderby = apply_filters('posts_orderby', $q['orderby']); 1437 $distinct = apply_filters('posts_distinct', $distinct); 1438 $fields = apply_filters('posts_fields', "$wpdb->posts.*"); 1439 $limits = apply_filters( 'post_limits', $limits ); 1440 } 1425 1441 1426 $where = apply_filters('posts_where_paged', $where);1427 $groupby = apply_filters('posts_groupby', $groupby);1428 $join = apply_filters('posts_join_paged', $join);1429 $orderby = apply_filters('posts_orderby', $q['orderby']);1430 $distinct = apply_filters('posts_distinct', $distinct);1431 $fields = apply_filters('posts_fields', "$wpdb->posts.*");1432 $limits = apply_filters( 'post_limits', $limits );1433 1434 1442 // Announce current selection parameters. For use by caching plugins. 1435 1443 do_action( 'posts_selection', $where . $groupby . $orderby . $limits . $join ); 1436 1444 1437 1445 // Filter again for the benefit of caching plugins. Regular plugins should use the hooks above. 1438 $where = apply_filters('posts_where_request', $where); 1439 $groupby = apply_filters('posts_groupby_request', $groupby); 1440 $join = apply_filters('posts_join_request', $join); 1441 $orderby = apply_filters('posts_orderby_request', $orderby); 1442 $distinct = apply_filters('posts_distinct_request', $distinct); 1443 $fields = apply_filters('posts_fields_request', $fields); 1444 $limits = apply_filters( 'post_limits_request', $limits ); 1446 if ( !$q['suppress_filters'] ) { 1447 $where = apply_filters('posts_where_request', $where); 1448 $groupby = apply_filters('posts_groupby_request', $groupby); 1449 $join = apply_filters('posts_join_request', $join); 1450 $orderby = apply_filters('posts_orderby_request', $orderby); 1451 $distinct = apply_filters('posts_distinct_request', $distinct); 1452 $fields = apply_filters('posts_fields_request', $fields); 1453 $limits = apply_filters( 'post_limits_request', $limits ); 1454 } 1445 1455 1446 1456 if ( ! empty($groupby) ) 1447 1457 $groupby = 'GROUP BY ' . $groupby; … … 1452 1462 $found_rows = 'SQL_CALC_FOUND_ROWS'; 1453 1463 1454 1464 $request = " SELECT $found_rows $distinct $fields FROM $wpdb->posts $join WHERE 1=1 $where $groupby $orderby $limits"; 1455 $this->request = apply_filters('posts_request', $request); 1465 if ( !$q['suppress_filters'] ) 1466 $this->request = apply_filters('posts_request', $request); 1456 1467 1457 1468 $this->posts = $wpdb->get_results($this->request); 1458 1469 // Raw results filter. Prior to status checks. 1459 $this->posts = apply_filters('posts_results', $this->posts); 1470 if ( !$q['suppress_filters'] ) 1471 $this->posts = apply_filters('posts_results', $this->posts); 1460 1472 1461 1473 if ( !empty($this->posts) && $this->is_comment_feed && $this->is_singular ) { 1462 1474 $cjoin = apply_filters('comment_feed_join', '');
