Title: BUG
Last modified: September 1, 2025

---

# BUG

 *  Resolved [agualtierimdn](https://wordpress.org/support/users/agualtierimdn/)
 * (@agualtierimdn)
 * [7 months ago](https://wordpress.org/support/topic/bug-450/)
 * Hello,
   I encountered a fatal error while using the **ghl-wizard** plugin on WordPress.
   The issue happens because the plugin loads several files (including `contacts.
   php`) directly from `apis.php` during plugin initialization.
 * This results in the following fatal error:
 * _**PHP Fatal error: Uncaught Error: Call to a member function using\_index\_permalinks()
   on null
   in /wp-includes/rest-api.php
   **
 * The require_once calls inside apis.php are executed too early, before WordPress
   finishes initializing $wp_rewrite and the REST API. This breaks functions like
   get_rest_url() when called during wp_head().
   I resolved the issue by wrapping
   the require_once calls inside an init action, like this:
 * add_action(‘init’, function() {
   require_once **DIR** . ‘/get-token.php’;require_once**
   DIR** . ‘/get-tags.php’;require_once **DIR** . ‘/get-campaigns.php’;require_once**
   DIR** . ‘/get-workflows.php’;require_once **DIR** . ‘/contacts.php’;require_once**
   DIR** . ‘/get-custom-values.php’;require_once **DIR** . ‘/get-custom-fields.php’;});
 * This ensures the plugin files are only loaded after WordPress is fully initialized,
   preventing the fatal error.
   Could you please update the plugin code accordingly
   in the next release, so that other users don’t run into the same issue?
 * Thanks for your support

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

 *  Plugin Contributor [betterwizard](https://wordpress.org/support/users/betterwizard/)
 * (@betterwizard)
 * [7 months ago](https://wordpress.org/support/topic/bug-450/#post-18623105)
 * Hi [@agualtierimdn](https://wordpress.org/support/users/agualtierimdn/),
   Thank
   you for noticing this, we will update it soon.
 *  Thread Starter [agualtierimdn](https://wordpress.org/support/users/agualtierimdn/)
 * (@agualtierimdn)
 * [7 months ago](https://wordpress.org/support/topic/bug-450/#post-18623798)
 * I installed version 1.2.20, but the bug is still there.
   You need to use **__DIR__**,
   otherwise it won’t work in most cases.This is how you do it:
 * add_action(‘init’, function() {
 * require_once __DIR__ . ‘/get-token.php’;
 * require_once __DIR__ . ‘/get-tags.php’;
 * require_once __DIR__ . ‘/get-campaigns.php’;
 * require_once __DIR__ . ‘/get-workflows.php’;
 * require_once __DIR__ . ‘/contacts.php’;
 * require_once __DIR__ . ‘/get-custom-values.php’;
 * require_once __DIR__ . ‘/get-custom-fields.php’;
 * });
 *  Plugin Contributor [betterwizard](https://wordpress.org/support/users/betterwizard/)
 * (@betterwizard)
 * [7 months ago](https://wordpress.org/support/topic/bug-450/#post-18623893)
 * Hi [@agualtierimdn](https://wordpress.org/support/users/agualtierimdn/) 
   Thank
   you so much! We’ve updated it. It’s a real pleasure to receive fixes from people
   like you.

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

The topic ‘BUG’ is closed to new replies.

 * ![](https://ps.w.org/ghl-wizard/assets/icon-256x256.png?rev=3357579)
 * [Connector Wizard (formerly LC Wizard)](https://wordpress.org/plugins/ghl-wizard/)
 * [Support Threads](https://wordpress.org/support/plugin/ghl-wizard/)
 * [Active Topics](https://wordpress.org/support/plugin/ghl-wizard/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ghl-wizard/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ghl-wizard/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [betterwizard](https://wordpress.org/support/users/betterwizard/)
 * Last activity: [7 months ago](https://wordpress.org/support/topic/bug-450/#post-18623893)
 * Status: resolved