• Resolved Roel Magdaleno

    (@rokumetal)


    Your plugin is throwing an error when I execute this WP CLI command in one of my client’s server:

    wp profile hook --all --spotlight --allow-root --format=table --orderby=time

    The errors are:

    #0 /www/.wp-cli/packages/vendor/wp-cli/profile-command/inc/class-profiler.php(486): ReflectionMethod->__construct(Object(CustomCSSandJS), 'print_frontend-...')

    Fatal error: Uncaught ReflectionException: Method CustomCSSandJS::print_frontend-js-header-external() does not exist in /www/.wp-cli/packages/vendor/wp-cli/profile-command/inc/class-profiler.php:486

    Looks like is trying to call print_frontend-js-header-external method when is not generated at the moment when I execute the command.

    That error won’t let me continue my profiling process so I have to deactivate for now. That’s the bug for now, hopefully you can fix it.

    Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author SilkyPress

    (@diana_burduja)

    The print_frontend-js-header-external function doesn’t exist. There is only a __call method that checks if the function name matches a certain format and then executes it based on the function name.

    I assume the wp profile command needs an actual function for every hook and doesn’t recognize the __call method.

    The __call method for executing functions like print_frontend-js-header-external is at the core of the Simple Custom CSS & JS plugin. This is not a small bug that can be solved with two lines of code. Avoiding using the __call method would mean to rewrite most of the plugin.

    I’ll talk to the developer of the wp profile command to see if we find a solution. Meanwhile you can use your command with the --skip-plugins argument, as follows:
    wp profile hook --all --spotlight --allow-root --format=table --orderby=time --skip-plugins=custom-css-js

    Thread Starter Roel Magdaleno

    (@rokumetal)

    Yes, that’s what I thought. Hopefully you can find a solution so other people can avoid this.

    Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘PHP method doesn’t exists when executing a WP CLI command’ is closed to new replies.