php - custom wordpress post type hierarchical alternative -
i have inherited wordpress project uses custom post type 'project'
$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 );
the hierarchical set true, result being in admin user can see post child of what. wordpress installation has many users can manage content of own respective projects.
there approx 3000 projects in system @ present.
there problem when logging wp-admin , loading projects page:
- when last page loaded, load time on 1 1/2 minutes.
- the definition of "last page" in instance when user clicks on last page in pagination links, or, if user can see 1 page of projects.
i have found load time issue can improved turning off hierarchical
. renders flat view of projects not customer needs...
it seems stuck between rock , hard place. has else encountered issue , found resolution?
edit: additional info:
- all plugins have been turned off page still loaded slowly.
- the dev env on server ample ram , cpu.
- the front end running fine.
this mysql slow log traced mysql queries start end of slow wp-admin page load:
# 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 options 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(*) icl_translation_status 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 tra, s.value org, s.domain_name_context_md5 ctx icl_strings s left join icl_string_translations st on s.id=st.string_id , st.status=10 , st.language='de' , 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 icl_translations t join term_taxonomy tax on t.element_id = tax.term_taxonomy_id , t.element_type = concat('tax_', tax.taxonomy) join terms terms on terms.term_id = tax.term_id 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(*) icl_translation_status 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( * ) num_comments comments join icl_translations icltr2 on icltr2.element_id = comments.comment_post_id join posts on posts.id = icltr2.element_id , concat('post_', posts.post_type) = icltr2.element_type left join icl_translations icltr_comment on icltr_comment.element_id = comments.comment_id , icltr_comment.element_type = 'comment' 1=1 , ( ( posts.post_type = 'attachment' , ( ( ( posts.post_type = 'attachment' , ( posts.post_author = 181 or ( posts.post_parent = 0 ) or ( posts.post_parent > 0 ) ) ) ) ) ) or ( posts.post_type = 'project' , ( ( ( 1=1 , ( ( ( posts.post_author = 181 ) , 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' , ( ( 1=1 , ( ( ( posts.post_author = 181 ) , posts.post_status in ('publish','future','draft','pending','private','inherit') ) ) ) ) ) ) , ( ( comment_approved = '0' or comment_approved = '1' ) ) , icltr2.language_code = 'de' , (icltr_comment.language_code null or icltr_comment.language_code = icltr2.language_code ) group comment_approved order 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 options autoload = 'yes';
this snapshot of projects page loads fine, till reach last page in pagination... , result takes forever load.
Comments
Post a Comment