PHP Warnings and Error when using WP-CLI

Support Forums for LiveMesh Themes & Plugins Forums Agile Theme Support PHP Warnings and Error when using WP-CLI

Tagged: , ,

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #18198
    tnoguchi
    Member

    Hi,

    I’m getting the following PHP errors and warnings in the following lines of code in page-customization.php for the site inquiringsystems.org:

    Warning: array_key_exists() expects parameter 2 to be array, null given in /vagrant/www/inquiringsystems/htdocs/wp-content/themes/agile/framework/functions/page-customization.php on line 134

    Fatal error: Call to a member function get_theme_option() on a non-object in /vagrant/www/inquiringsystems/htdocs/wp-content/themes/agile/framework/functions/page-customization.php on line 137

    Looking at the lines of code in question I see:

      if (array_key_exists($option_id, $options_cache))
                return $options_cache[$option_id];
    
            $option_value = $mo_theme->get_theme_option($option_id, $default, $single);

    I noticed that $options_cache is defined as an array in line 17 of the functions.php file.

    For the most part it doesn’t seem to effect any functionality on the site, but only when I’m using WP-CLI to update or manipulate the site’s DB.

    Any insights would be appreciated.

    #18199
    tnoguchi
    Member

    Also, I’m using version 3.6 of the theme and running a child theme. WP is at version 4.4 and all plugins are up to date.

    #18225
    Raghavendra
    Moderator

    Looks like $mo_theme var is not initialized and hence the error. It is initialized in functions.php file at line number 22 –

    if (!isset($mo_theme)) {
    $mo_theme = new MO_Framework();
    }
    

    and hence I am not sure why it has not been initialized.

    I did some research and found this thread that discusses this –

    https://github.com/wp-cli/wp-cli/issues/2289

    Can you use the option –skip-themes to skip loading agile when using wp-cli?

    #24036
    Raghavendra
    Moderator

    Regarding the WP-CLI error, I could not get back to earlier since I was not able to get WP-CLI working right. Sorry about that.

    Just add this line to the top of functions.php at line number 16 –

    global $theme_cache, $options_cache, $mo_theme;

    and WP-CLI should work fine.

    Related to the long discussion in this issue – https://github.com/wp-cli/wp-cli/issues/2289

    We will issue an update next week with the above change for Fusion and hence this change won’t be required in future updates.

Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘Agile Theme Support’ is closed to new topics and replies.