fix queries
This commit is contained in:
parent
4414121502
commit
37c61fbf07
1 changed files with 13 additions and 16 deletions
|
@ -431,25 +431,22 @@ class Followers {
|
||||||
*/
|
*/
|
||||||
public static function get_outdated_followers( $number = 50, $older_than = 604800 ) {
|
public static function get_outdated_followers( $number = 50, $older_than = 604800 ) {
|
||||||
$args = array(
|
$args = array(
|
||||||
'taxonomy' => self::POST_TYPE,
|
'post_type' => self::POST_TYPE,
|
||||||
'number' => $number,
|
'posts_per_page' => $number,
|
||||||
'meta_key' => 'updated_at',
|
'orderby' => 'modified',
|
||||||
'orderby' => 'meta_value_num',
|
|
||||||
'order' => 'DESC',
|
'order' => 'DESC',
|
||||||
'meta_query' => array(
|
'date_query' => array(
|
||||||
array(
|
array(
|
||||||
'key' => 'updated_at',
|
'column' => 'post_modified_gmt',
|
||||||
'value' => time() - $older_than,
|
'before' => 604800,
|
||||||
'type' => 'numeric',
|
|
||||||
'compare' => '<=',
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
$terms = new WP_Term_Query( $args );
|
$posts = new WP_Query( $args );
|
||||||
$items = array();
|
$items = array();
|
||||||
|
|
||||||
foreach ( $terms->get_terms() as $follower ) {
|
foreach ( $posts->get_posts() as $follower ) {
|
||||||
$items[] = new Follower( $follower ); // phpcs:ignore
|
$items[] = new Follower( $follower ); // phpcs:ignore
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -476,10 +473,10 @@ class Followers {
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
$terms = new WP_Term_Query( $args );
|
$posts = new WP_Query( $args );
|
||||||
$items = array();
|
$items = array();
|
||||||
|
|
||||||
foreach ( $terms->get_terms() as $follower ) {
|
foreach ( $posts->get_posts() as $follower ) {
|
||||||
$items[] = new Follower( $follower ); // phpcs:ignore
|
$items[] = new Follower( $follower ); // phpcs:ignore
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue