简体   繁体   中英

Wordpress: List page of custom post type in wp-admin return “Allowed memory size Error”

I had a error of "Allowed memory size" in list page of custom post type.
It was solved by adding more memory of php.

/wp-admin/edit.php?post_type=products

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 32 bytes) in /wp-includes/taxonomy.php on line 1858

It is strange because this problem does not occur with other list page with different custom post type.

I checked debug backtrace.
The products list has approximately 5000 record.

query_posts method get all products's record from database.
query_string is

 "order=asc&orderby=menu_order%20title&post_type=products&posts_per_page=-1&posts_per_archive_page=-1 "

I think that this problem occurred by getting all records as wp object.

My question is:
Is there a way to display this list page without getting all records?
Is there anything wrong with my wordpress setting?

Thanx for helping.

This problem is solved.
When opening wp-admin/edit.php of hierarchical custom post type, wordpress get all records.
So I set hierarchical=false in setting of custom post type.
We didn't need hierarchical=true in setting of custom post type.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM