Title: Plugin requests all forms on page init
Last modified: January 20, 2021

---

# Plugin requests all forms on page init

 *  Resolved [Ahmed ElSayed](https://wordpress.org/support/users/a7madmayo/)
 * (@a7madmayo)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/plugin-requests-all-forms-on-page-init/)
 * Hi,
    I have an issue with the Plugin as requests all forms on every page init
   which exhaust my hosting server, I just want to know why all of these queries
   in every page load and how to stop that? Thanks
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fplugin-requests-all-forms-on-page-init%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

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

 *  Plugin Author [Mark Howells-Mead](https://wordpress.org/support/users/markhowellsmead/)
 * (@markhowellsmead)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/plugin-requests-all-forms-on-page-init/#post-13933055)
 * The plugin has to load all of the available forms when you enter the Edit Field
   Group screen in WordPress Admin, so that you can select the form which you want
   to include in the ACF output. This only has an effect in WordPress Admin, as 
   this plugin has nothing to do with the frontend of the website. (Unless you’re
   using the `acf_form` function on public pages.)
 *  Thread Starter [Ahmed ElSayed](https://wordpress.org/support/users/a7madmayo/)
 * (@a7madmayo)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/plugin-requests-all-forms-on-page-init/#post-13933692)
 * Hi Mark,
    I think I wasn’t clear enough,
 * Using Query Monitor, I found alot of queries executed on the homepage for example
   this query
    SELECT * FROM wp_6_gf_form WHERE id=2 /* [http://www.edntaiwan.com/](http://www.edntaiwan.com/)*/
 * why these queries executed in homepage?
    Thanks
 *  Plugin Author [Mark Howells-Mead](https://wordpress.org/support/users/markhowellsmead/)
 * (@markhowellsmead)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/plugin-requests-all-forms-on-page-init/#post-13933716)
 * I don’t know, sorry. That would most likely depend on the remainder of the code
   which you’re using on the website. This plugin doesn’t interfere with any content
   placed on the website. (Unless, as I wrote, you’re using the `acf_form` function
   on public pages.)
 *  [GetWeb.cz](https://wordpress.org/support/users/getwebcz/)
 * (@getwebcz)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/plugin-requests-all-forms-on-page-init/#post-14342408)
 * Hi,
 * we were able to reproduce this issue using version 1.2.7 and ACF Pro 5.9.4. I
   think the problem is that all forms are loaded in the __construct method of ACFGravityformsField\
   Field class:
 *     ```
       	public function __construct()
       	{
       		$this->name = 'forms';
       		$this->label = __('Forms', 'gravityforms');
       		$this->category = __('Relational', 'acf');
       		$this->defaults = [
       			'return_format' => 'form_object',
       			'multiple'      => 0,
       			'allow_null'    => 0
       		];
   
       		// Get our notices up and running
       		$this->notices = new Notices();
   
       		if (class_exists('GFAPI')) {
       			$this->forms = GFAPI::get_forms();
       		}
   
       		// Execute the parent constructor as well
       		parent::__construct();
       	}
       ```
   
 * We fixed it temporarily by replacing the condition in __construct method:
 *     ```
       if (class_exists('GFAPI') && is_admin()) {
           $this->forms = GFAPI::get_forms();
       }
       ```
   
 * Ideally `$this->forms` should be replaced with method which loads forms dynamically
   when needed.
 *  Plugin Author [Mark Howells-Mead](https://wordpress.org/support/users/markhowellsmead/)
 * (@markhowellsmead)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/plugin-requests-all-forms-on-page-init/#post-14343192)
 * Please try version 1.2.8, which is now available in the plugin repository.
 *  Thread Starter [Ahmed ElSayed](https://wordpress.org/support/users/a7madmayo/)
 * (@a7madmayo)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/plugin-requests-all-forms-on-page-init/#post-14345359)
 * [@all](https://wordpress.org/support/users/all/) Thanks for your help
 *  Plugin Author [Mark Howells-Mead](https://wordpress.org/support/users/markhowellsmead/)
 * (@markhowellsmead)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/plugin-requests-all-forms-on-page-init/#post-14374884)
 * Version 1.2.8 resolves this support request.

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

The topic ‘Plugin requests all forms on page init’ is closed to new replies.

 * ![](https://ps.w.org/acf-gravityforms-add-on/assets/icon-256x256.png?rev=1631911)
 * [Advanced Custom Fields: Gravity Forms Add-on](https://wordpress.org/plugins/acf-gravityforms-add-on/)
 * [Support Threads](https://wordpress.org/support/plugin/acf-gravityforms-add-on/)
 * [Active Topics](https://wordpress.org/support/plugin/acf-gravityforms-add-on/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/acf-gravityforms-add-on/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/acf-gravityforms-add-on/reviews/)

 * 7 replies
 * 3 participants
 * Last reply from: [Mark Howells-Mead](https://wordpress.org/support/users/markhowellsmead/)
 * Last activity: [5 years, 1 month ago](https://wordpress.org/support/topic/plugin-requests-all-forms-on-page-init/#post-14374884)
 * Status: resolved