Title: Problems with Plugin &#8220;elasticpress&#8221;
Last modified: October 2, 2018

---

# Problems with Plugin “elasticpress”

 *  Resolved [reasonx](https://wordpress.org/support/users/reasonx/)
 * (@reasonx)
 * [7 years, 8 months ago](https://wordpress.org/support/topic/problems-with-plugin-elasticpress/)
 * Hi,
 * we are using the free FooGallery Plugin and have encountered a bug in connection
   with another WordPress Plugin called “elasticpress”. This Plugin adds elasticsearch
   functionality within WordPress. As soon as both plugins are active an endless
   loop gets created somehow which leads to thousands of redundant “_foogallery_css”
   entries in the wp_postmeta table until the timeout happens.
 * To confirm this is an issue of one of the both plugins we set up a fresh wordpress
   installation (latest version) with only the default wp theme active and no other
   plugins active except the two before mentioned (latest versions of course). The
   error occurs. So it has to be an issue of one of the both Plugins. Maybe you 
   could help us with that. Of course we have also asked for Support on GitHub for
   the other Plugin.
 * Additionally we have encountered issues that we wanted to share with you:
 * 1. On our main site, we currently have 7000+ FooGalleries active. If you want
   to add a gallery in the wordpress editor with the Button, it loads all the 7000
   + Galleries and that takes forever of course. Unusable for us. The news editors
   have to write the shortcodes manually and therefore have to look up the gallery
   id in advance. That is unhandy.
 * 2. The “usage” Feature in the FooGallery Backend is not compatible with custom
   post types which is surprising. We have many custom post types and therefore 
   the field “usage” displays “Not in use” for most of the galleries except for 
   the ones with post_type post of course. We have looked up the code for it in 
   your plugin and saw that you only support the post_type “post”. Maybe you can
   add Support for custom post types in the future. That would be great.
 * Thank you very much for your attention.
    Best regards

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Plugin Author [bradvin](https://wordpress.org/support/users/bradvin/)
 * (@bradvin)
 * [7 years, 8 months ago](https://wordpress.org/support/topic/problems-with-plugin-elasticpress/#post-10743658)
 * hi
 * I have installed ElasticPress but it requires an account with a 3rd party site
   to get it working. I will contact the developers to see if I can get a test account
   setup to replicate your issue.
 * As for your other requests… others have asked for similar, so I will start working
   on those now that the video update has finally been released (6 months in the
   making)
 *  Thread Starter [reasonx](https://wordpress.org/support/users/reasonx/)
 * (@reasonx)
 * [7 years, 8 months ago](https://wordpress.org/support/topic/problems-with-plugin-elasticpress/#post-10748946)
 * Hi,
 * thank you very much for the fast response. We appreciate that. In the meantime
   we have tracked down or at least delimited the problem in the code. Please keep
   in mind that this behavior is only reproduced when both plugins are active.
 * 1. foogallery/includes/admin/class-admin-css-load-optimizer.php line 49
 * `if ( false !== ( $css_location = $this->_locator->locate_file( "gallery-{$template}.
   css" ) ) )`
 * This check returns false ALWAYS. Therefore the following post_meta entry is never
   performed.
 * 2. foogallery/includes/public/class-css-load-optimizer.php line 117
 * `if ( is_array( $enqueued_foogallery_styles ) && ! array_key_exists( $style_handle,
   $enqueued_foogallery_styles ) )`
 * This check does not seem to be enough because the following add_post_meta() is
   performed over and over again until the timeout which leads to thousands of entires
   in the DB. The loop is somehow created by elasticpress. They hooked a sync method
   on the “added_post_meta” Hook which gets triggered every time. You can look up
   the method in elasticpress/classes/class-ep-sync-manager.php on line 94 or the
   add_action on line 45 in the same file.
 * Essentially this method fills an array which is later evaluated in a foreach 
   loop.
 * Whatever the problem is in detail, we have fixed it for now by removing the “
   add_post_meta()” in the class-css-load-optimizer.php on line 127. Of course, 
   if we want to update the Plugin, the changes are gone so we hope it gets fixed
   in future versions 🙂
 * Best regards
 *  Plugin Author [bradvin](https://wordpress.org/support/users/bradvin/)
 * (@bradvin)
 * [7 years, 7 months ago](https://wordpress.org/support/topic/problems-with-plugin-elasticpress/#post-10779044)
 * hi again,
 * The good folks at 10up gave me a free trial with their service, and I managed
   to resolve the conflict with ElasticPress, so the site does not go into an infinite
   loop.
 * You can test this out from the develop branch : [https://github.com/fooplugins/foogallery/tree/develop](https://github.com/fooplugins/foogallery/tree/develop)
 * It will be included in the next release
 *  Thread Starter [reasonx](https://wordpress.org/support/users/reasonx/)
 * (@reasonx)
 * [7 years, 7 months ago](https://wordpress.org/support/topic/problems-with-plugin-elasticpress/#post-10780367)
 * Hi,
 * that´s awesome!! Thank you very much for your effort. We didn´t expect this support
   request to be solved so well and so fast. We appreciate that and we take this
   into account for the purchase of the pro version we will do in the near future.
 * Best regards,
    Arvid

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Problems with Plugin “elasticpress”’ is closed to new replies.

 * ![](https://ps.w.org/foogallery/assets/icon-256x256.gif?rev=2602542)
 * [Photo Gallery by FooGallery : Responsive Image Gallery, Masonry Gallery & Carousel](https://wordpress.org/plugins/foogallery/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/foogallery/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/foogallery/)
 * [Active Topics](https://wordpress.org/support/plugin/foogallery/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/foogallery/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/foogallery/reviews/)

## Tags

 * [admin](https://wordpress.org/support/topic-tag/admin/)
 * [Backend](https://wordpress.org/support/topic-tag/backend/)
 * [custom](https://wordpress.org/support/topic-tag/custom/)
 * [elasticsearch](https://wordpress.org/support/topic-tag/elasticsearch/)
 * [post](https://wordpress.org/support/topic-tag/post/)
 * [usage](https://wordpress.org/support/topic-tag/usage/)

 * 4 replies
 * 2 participants
 * Last reply from: [reasonx](https://wordpress.org/support/users/reasonx/)
 * Last activity: [7 years, 7 months ago](https://wordpress.org/support/topic/problems-with-plugin-elasticpress/#post-10780367)
 * Status: resolved