我继承了一个使用自定义帖子类型的WordPress项目'
$args = array(
'public' => true,
'hierarchical' => true,
'labels' => array(
'name' => __( 'Projekte' ),
'singular_name' => __( 'Projekt' ),
'add_new' => __( 'Neues Projekt erstellen' ),
'add_new_item' => __( 'Neues Projekt erstellen' ),
'edit' => __( 'Bearbeiten' ),
'edit_item' => __( 'Projekt bearbeiten' ),
'new_item' => __( 'Neues Projekt anlegen' ),
'view' => __( 'Projekt anzeigen' ),
'view_item' => __( 'Projekt anzeigen' ),
'search_items' => __( 'Projekt suchen' ),
'not_found' => __( 'Kein Projekt gefunden' ),
'not_found_in_trash' => __( 'Kein Projekt im Papierkorb' ),
'parent' => __( 'Übergeordnetes Projekt' ),
),
'supports' => array(
'title',
'editor',
'page-attributes',
'thumbnail'
),
'capability_type' => 'project',
'capabilities' => array(
'publish_posts' => 'publish_projects',
'edit_posts' => 'edit_projects',
'edit_others_posts' => 'edit_others_projects',
'delete_posts' => 'delete_projects',
'delete_others_posts' => 'delete_others_projects',
'read_private_posts' => 'read_private_projects',
'edit_post' => 'edit_project',
'delete_post' => 'delete_project',
'read_post' => 'read_project',
'create_posts' => 'create_projects',
),
'menu_icon' => 'dashicons-analytics'
);
register_post_type( 'project', $args );
层次结构设置为true,结果在管理员中,用户可以清楚地看到哪个帖子是什么的孩子。 wordpress安装有许多用户都可以管理他们各自项目的内容。
目前系统中约有3000个项目。
登录wp-admin并加载项目页面时出现问题:
我发现可以通过关闭hierarchical
来改善此加载时间问题。然而,这使得项目的平面视图不是客户需要的......
似乎我被困在一块岩石和坚硬的地方之间。有没有其他人遇到过这个问题并找到了决议?
编辑: 其他信息:
这是从慢速wp-admin页面加载开始到结束跟踪所有mysql查询的mysql慢速日志:
# User@Host: wp_user[wp_user] @ localhost [] Id: 50
# Query_time: 0.004904 Lock_time: 0.000116 Rows_sent: 403 Rows_examined: 578
SET timestamp=1467216512;
SELECT option_name, option_value FROM options WHERE autoload = 'yes';
# Time: 2016-06-29T16:08:32.265525Z
# User@Host: wp_user[wp_user] @ localhost [] Id: 50
# Query_time: 0.000267 Lock_time: 0.000110 Rows_sent: 1 Rows_examined: 47
SET timestamp=1467216512;
SELECT COUNT(*)
FROM icl_translation_status
WHERE translation_service = 'icanlocalize';
# Time: 2016-06-29T16:08:32.331843Z
# User@Host: wp_user[wp_user] @ localhost [] Id: 50
# Query_time: 0.000760 Lock_time: 0.000117 Rows_sent: 105 Rows_examined: 212
SET timestamp=1467216512;
SELECT
st.value AS tra,
s.value AS org,
s.domain_name_context_md5 AS ctx
FROM icl_strings s
LEFT JOIN icl_string_translations st
ON s.id=st.string_id
AND st.status=10
AND st.language='de'
AND s.language!='de';
# Time: 2016-06-29T16:08:32.530835Z
# User@Host: wp_user[wp_user] @ localhost [] Id: 50
# Query_time: 0.000215 Lock_time: 0.000098 Rows_sent: 0 Rows_examined: 14
SET timestamp=1467216512;
SELECT t.element_id, tax.term_id, tax.taxonomy
FROM icl_translations t
JOIN term_taxonomy tax
ON t.element_id = tax.term_taxonomy_id
AND t.element_type = CONCAT('tax_', tax.taxonomy)
JOIN terms terms
ON terms.term_id = tax.term_id
WHERE tax.term_id != tax.term_taxonomy_id;
# Time: 2016-06-29T16:08:32.562377Z
# User@Host: wp_user[wp_user] @ localhost [] Id: 50
# Query_time: 0.000298 Lock_time: 0.000116 Rows_sent: 1 Rows_examined: 47
SET timestamp=1467216512;
SELECT COUNT(*)
FROM icl_translation_status
WHERE translation_service = 'icanlocalize';
# Time: 2016-06-29T16:08:32.770419Z
# User@Host: wp_user[wp_user] @ localhost [] Id: 50
# Query_time: 0.001579 Lock_time: 0.000607 Rows_sent: 0 Rows_examined: 21
SET timestamp=1467216512;
SELECT comment_approved, COUNT( * ) AS num_comments FROM comments JOIN icl_translations icltr2
ON icltr2.element_id = comments.comment_post_ID
JOIN posts ON posts.ID = icltr2.element_id
AND CONCAT('post_', posts.post_type) = icltr2.element_type
LEFT JOIN icl_translations icltr_comment
ON icltr_comment.element_id = comments.comment_ID
AND icltr_comment.element_type = 'comment'
WHERE 1=1 AND ( ( posts.post_type = 'attachment' AND ( ( ( posts.post_type = 'attachment' AND ( posts.post_author = 181 OR ( posts.post_parent = 0 ) OR ( posts.post_parent > 0 ) ) ) ) ) ) OR ( posts.post_type = 'project' AND ( ( ( 1=1 AND ( ( ( posts.post_author = 181 ) AND posts.post_status IN ('publish','future','draft','pending','private','inherit') ) ) ) OR ( ( ( posts.ID IN ('8132','8133','8134','8141','8142','8143','8144','8145','8146','8147','8148','8149','8150','8151','8152','8140','8135') ) ) ) ) ) ) OR ( posts.post_type = 'event' AND ( ( 1=1 AND ( ( ( posts.post_author = 181 ) AND posts.post_status IN ('publish','future','draft','pending','private','inherit') ) ) ) ) ) ) AND ( ( comment_approved = '0' OR comment_approved = '1' ) ) AND icltr2.language_code = 'de'
AND (icltr_comment.language_code IS NULL
OR icltr_comment.language_code = icltr2.language_code
) GROUP BY comment_approved ORDER BY comments.comment_date_gmt DESC;
# Time: 2016-06-29T16:08:32.786531Z
# User@Host: wp_user[wp_user] @ localhost [] Id: 50
# Query_time: 0.003861 Lock_time: 0.000051 Rows_sent: 403 Rows_examined: 578
SET timestamp=1467216512;
SELECT option_name, option_value FROM options WHERE autoload = 'yes';