Skip to content

undefined function add_filter() and apply_filters() #1310

@javiertury

Description

@javiertury

After configuring automatic updates following http://codex.wordpress.org/Configuring_Automatic_Background_Updates using wp-cli gives the following error:
PHP Fatal error: Call to undefined function add_filter() in phar:///usr/local/bin/wp/php/wp-cli.php(23) : eval()'d code on line 50 The same happens for apply_filters() function

My configuration is working properly with respect to wordpress itself, and yes, I've put the configuration after this line:
require_once( ABSPATH . 'wp-settings.php' );

Has wp-cli problems with the previous line? Have I misconfigured anything?

This is my custom config of wp-config.php

/* That's all, stop editing! Happy blogging. */

/** Absolute path to the WordPress directory. */
if ( !defined('ABSPATH') )
        define('ABSPATH', dirname(__FILE__) . '/');

/** Sets up WordPress vars and included files. */
require_once(ABSPATH . 'wp-settings.php');

define( 'FORCE_SSL_LOGIN', true );
define( 'FORCE_SSL_ADMIN', true );
define( 'WP_AUTO_UPDATE_CORE', true );
add_filter( 'allow_major_auto_core_updates', '__return_true' );
add_filter( 'automatic_updates_is_vcs_checkout', '__return_false', 1 );
add_filter( 'auto_update_plugin', '__return_true' );
add_filter( 'auto_update_theme', '__return_true' );
apply_filters( 'auto_core_update_send_email', false, success, $core_update, $result );

Edit: the error occurs with most commands such as wp plugin list but not with others e.g. wp --version. The version I'm using is WP-CLI 0.16.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions