parisholley / wordpress-fantastic-elasticsearch

Improve wordpress search performance/accuracy and enable faceted search by leveraging an ElasticSearch server.
MIT License
162 stars 64 forks source link

PHP warning if no categories are selected for facet #84

Closed feribg closed 10 years ago

feribg commented 10 years ago

If you leave the "Categories to enable" option blank as is often the case, the following warning will be issued depending on PHP error settings:

_" Warning: inarray() expects parameter 2 to be array, null given in wp-content\plugins\fantastic-elasticsearch\wp\theme\category.php on line 37"

This is due to the: $enabled = Config::option('enable_categories'); returning null if there is no category selected. A very easy fix would be to add after it: $enabled = $enabled !== null ? $enabled : array();

Sorry but i dont have time to go over submitting a pull request now since im sending that form a windows machine and the build scripts assume linux env.

Aetles commented 10 years ago

I'm seeing this as well (but with "line 36"), after network activating Fantastic ElasticSearch.

parisholley commented 10 years ago

fixed in 3.0