BUG
-
Hello,
I encountered a fatal error while using the ghl-wizard plugin on WordPress.
The issue happens because the plugin loads several files (includingcontacts.php) directly fromapis.phpduring 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.phpThe 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
The topic ‘BUG’ is closed to new replies.