문제

I know that it is possible to restrict (or extend) the memory usage of the entire WP site using:

define('WP_MEMORY_LIMIT', '64M')

Is it possible to do the same for only one plugin that the website uses ?

도움이 되었습니까?

해결책

No and even if you could, if the plugin ran out of available memory then the entire page generation would stop due to the fatal error.

You're better off fixing the plugin itself to not use as much memory or to just further increase the total memory allocated to WordPress/PHP.

다른 팁

Generally spoken, no, it is not possible for a particular plugin only. The plugin runs in the whole wordpress PHP process (normally) and therefore it shares the memory limit setting with the rest.

You can however try to limit the memory before each time the plugin is called. That would be prior any hook of it (that's possible) and then in the beginning prior the inclusion (that's much harder to achieve).

The define of WP_MEMORY_LIMIT gets overwritten by the way, so setting that constant to something is not useful if you actually want to limit memory.

If you do not fear to deal with system internals, you can however limit the memory for the whole process properly as well as if you like it experimental, you can give runkit a try and execute the plugins code therein - somehow.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 wordpress.stackexchange
scroll top