Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/239.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 超过20000个分类分类问题-wordpress_Php_Wordpress_Custom Taxonomy_Taxonomy Terms - Fatal编程技术网

Php 超过20000个分类分类问题-wordpress

Php 超过20000个分类分类问题-wordpress,php,wordpress,custom-taxonomy,taxonomy-terms,Php,Wordpress,Custom Taxonomy,Taxonomy Terms,我在用wordpress。并插入了超过20000个产品类别,但现在我显示所有类别的页面已关闭,无法使用 即使是在后端,经过一些分类之后,我也看不到rest。我看到以下错误: Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 262144 bytes) in /wp-admin/includes/class-wp-terms-list-table.php on line 273 Ma

我在用wordpress。并插入了超过20000个产品类别,但现在我显示所有类别的页面已关闭,无法使用

即使是在后端,经过一些分类之后,我也看不到rest。我看到以下错误:

Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 262144 
bytes) in /wp-admin/includes/class-wp-terms-list-table.php on line 273

Maximum execution time of 30 seconds exceeded in class-wp-terms-list-table.php on line 273

PHP Fatal error:  Maximum execution time of 30 seconds exceeded in
/wp-includes/taxonomy.php on line 0
我尝试将php.ini设置增加到以下内容:

memory_limit = 1024M
max_execution_time = 3000

但是没有运气。问题是什么?我遗漏了什么吗?

尝试通过纯SQL查询获取类别(而不是像get\u terms这样的wordpress函数)。

哇。太多了!就wordpress而言,你会慢慢地杀死你的服务器。 我想建议几件事

  • 现在转移到独立服务器(linode/digital ocean)以合理的价格提供良好的解决方案

  • 关于实现缓存,我还建议使用内存缓存,比如memcached或redis,这两种缓存的实现都存在于wordpress.org/plugins目录中

  • wordpress域中的提升内存限制在下一步中完成。您需要定义要在wp-config.php中使用的内存量。e、 g

    定义('WP_MEMORY_LIMIT','512M')

  • 时间限制可以在下一种方式中完成(也可以在wp配置中),但我建议用另一种方式(嵌入缓存)修复ISU

    @ini_集('max_execution_time',0); @设置时间限制(0)

  • 请考虑将你的分类变为标签(如果它不需要继承),并用正常的方式查看你的类别。例如,在WordPress中获取类别列表,触发3个表(联接等)

  • 解决这个问题的另一种方法是通过wordpress过滤器更改SQL(但在ca中,对于get_术语,用纯wordpress的方式实现有点困难)


  • 为什么您需要一次性列出所有20000个产品类别?如果有那么多,请使用paging/filter/search/infinite scroll或类似的方法。问题是,它们甚至没有显示在后端的分页@MagnusErikssonI,我很困惑。你说你有一个显示所有类别的页面?“甚至不在后台显示”是什么意思?如何在后端显示它们?使用分页意味着您不会一次从数据库中获取所有类别,而只获取一个子集。我的意思是在管理面板的分类类别页面中(edit tags.php?taxonomy=product category&post_type=product items)@MagnusErikssonOh。你说的是管理员?所以Wordpress不能在管理中显示它们?你能给我举个例子吗@托马斯温特