@@ 1901-1912 (lines=12) @@ | ||
1898 | * @param array $pieces |
|
1899 | * @return array $pieces |
|
1900 | */ |
|
1901 | public static function comment_total_sum_meta_value_filter( $pieces ) { |
|
1902 | global $wpdb, $wp_version; |
|
1903 | ||
1904 | $pieces['fields'] = " COUNT(*) AS total, SUM($wpdb->commentmeta.meta_value) AS meta_sum "; |
|
1905 | unset( $pieces['groupby'] ); |
|
1906 | if ( version_compare($wp_version, '4.1', '>=') ) { |
|
1907 | $args['order'] = false; |
|
1908 | $args['orderby'] = false; |
|
1909 | } |
|
1910 | ||
1911 | return $pieces; |
|
1912 | } |
|
1913 | ||
1914 | /** |
|
1915 | * Shifts counting of posts to the database where it should be. Likely not to be used due to knock on issues. |
|
@@ 1921-1931 (lines=11) @@ | ||
1918 | * @param array $pieces (default: array()) |
|
1919 | * @return array |
|
1920 | */ |
|
1921 | public static function get_posts_count_only_filter( $pieces ) { |
|
1922 | global $wp_version; |
|
1923 | ||
1924 | $pieces['fields'] = " COUNT(*) AS total "; |
|
1925 | unset( $pieces['groupby'] ); |
|
1926 | if ( version_compare($wp_version, '4.1', '>=') ) { |
|
1927 | $args['order'] = false; |
|
1928 | $args['orderby'] = false; |
|
1929 | } |
|
1930 | return $pieces; |
|
1931 | } |
|
1932 | ||
1933 | /** |
|
1934 | * |