libreform / wp-libre-form

Easy native HTML5 forms for WordPress. Version 1.5 is unmaintained, but works without issue. 2.0 has been rewritten from the ground, and can be found at https://github.com/libreform/libreform
https://wordpress.org/plugins/wp-libre-form
GNU General Public License v3.0
67 stars 27 forks source link

Form query optimizations #159

Closed luizbills closed 5 years ago

luizbills commented 5 years ago

Reason

My customer uses polylang plugin to create a form for each language (I did not know the native integration that wplf has). So some forms, some forms did not appear in the filter dropdown. But with WP_Query it appears (I don't know why).

Optimizations

A new WP_Query object runs five queries by default, including calculating pagination and priming the term and meta caches. Each of the following arguments will remove a query:

Note: get_posts() actually calls WP_Query, but calling get_posts() directly bypasses a number of filters by default. Not sure whether you need these things or not? You probably don’t.

Based on: https://10up.github.io/Engineering-Best-Practices/php/#performance