admin管理员组

文章数量:1122832

on my WooCommerce website (I did test 3 themes xstore - flatsome - woodmart) when trying to browse product category page its take long time to load, I did use Query monitor to check my issue i found that

WP_Query->get_posts()

wp-includes/class-wp-query.php:3357

WP_Query->query()

wp-includes/class-wp-query.php:3852

WP->query_posts()

wp-includes/class-wp.php:696

WP->main()

wp-includes/class-wp.php:816

wp() wp-includes/functions.php:1336

Main Query

take time to load more than 33 sec

and this is the log at Query:

SELECT SQL_CALC_FOUND_ROWS mVkV6_posts.ID

FROM mVkV6_posts

LEFT JOIN mVkV6_term_relationships

ON (mVkV6_posts.ID = mVkV6_term_relationships.object_id)

INNER JOIN mVkV6_postmeta

ON ( mVkV6_posts.ID = mVkV6_postmeta.post_id )

INNER JOIN mVkV6_postmeta AS mt1

ON ( mVkV6_posts.ID = mt1.post_id )

WHERE 1=1

AND ( mVkV6_posts.ID NOT IN (

SELECT object_id

FROM mVkV6_term_relationships

WHERE term_taxonomy_id IN (7,9) )

AND mVkV6_term_relationships.term_taxonomy_id IN (366) )

AND ( ( mVkV6_postmeta.meta_key = '_price'

AND CAST(mVkV6_postmeta.meta_value AS SIGNED) != '' )

OR ( mt1.meta_key = '_price'

AND CAST(mt1.meta_value AS SIGNED) != '0' ) )

AND ((mVkV6_posts.post_type = 'product'

AND (mVkV6_posts.post_status = 'publish'

OR mVkV6_posts.post_status = 'wc-shipping'

OR mVkV6_posts.post_status = 'wc-shipped-status'

OR mVkV6_posts.post_status = 'private')))

GROUP BY mVkV6_posts.ID

ORDER BY mVkV6_posts.menu_order ASC, mVkV6_posts.post_title ASC

LIMIT 0, 12

本文标签: woocommerce offtopicWPQuerygtgetposts() take too long time to load data maybe 33 sec