我想知道您是否可以帮助我从作者存档页中找出一些问题,这些问题正在杀死我的数据库服务器。运行这些查询需要7-15秒!
下面是一个示例:
SELECT SQL_CALC_FOUND_ROWS wp_posts.ID
FROM wp_posts
LEFT JOIN wp_term_relationships ON (
wp_posts.ID = wp_term_relationships.object_id
)
LEFT JOIN wp_term_taxonomy ON (
wp_term_relationships.term_taxonomy_id = wp_term_taxonomy.term_taxonomy_id
)
WHERE
1=1
AND (
(
wp_posts.post_author = 2336
OR (
wp_term_taxonomy.taxonomy = \'author\'
AND wp_term_taxonomy.term_id = \'12954\'
)
)
)
AND wp_posts.post_type = \'post\'
AND (
wp_posts.post_status = \'publish\'
OR wp_posts.post_status = \'private\'
)
GROUP BY wp_posts.ID
HAVING MAX(
IF(
wp_term_taxonomy.taxonomy = \'author\',
IF ( wp_term_taxonomy.term_id = \'12954\',2,1 ),
0
)
) <> 1
ORDER BY wp_posts.post_date DESC
LIMIT 0, 10
发件人
rhrealitycheck.org/author/name-edited/
在里面
/nas/wp/www/cluster-1516/rhrealitycheck/index.php:17
require(\'wp-blog-header.php\'), wp, WP->main, WP->query_posts, WP_Query->query, WP_Query->get_posts (9,297.1ms)
为什么这个问题如此复杂,仅仅是为了从某个作者那里获取最新的10篇帖子?
我可以做些什么来覆盖查询,比如pre_get_posts
筛选输入functions.php
? 如果是这样的话,我该如何启动该过滤器并将其定位为只编写归档页?