Skip to content

Commit

Permalink
Merge pull request #6 from nathanbarry/avoid-unnecessary-requests
Browse files Browse the repository at this point in the history
Don't call api forms endpoint if there's no form to be shown
  • Loading branch information
marcboquet committed Feb 12, 2016
2 parents 3a67082 + 7365d19 commit 5224675
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions wp-convertkit.php
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,10 @@ public static function get_form_embed($attributes) {
$form_id = intval(($form < 0) ? self::_get_settings('default_form') : $form);
$form = false;

if ($form_id == 0) {
return "";
}

$forms_available = self::$api->get_resources('forms');
foreach($forms_available as $form_available) {
if($form_available['id'] == $form_id) {
Expand Down

0 comments on commit 5224675

Please sign in to comment.