Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter Jon Brown

    (@jb510)

    Fixing that did seem to get it to no longer kill WP CLI, however there are still other issues with paths causing fatals.

    this -> $plugin_meta seems to be getting referenced in places it’s not actually available.

    Anyway, I refactored all the path references.

    https://github.com/jb510/wp-comment-fields

    Also note:
    config.php:10 reads
    $plugin_dir = 'wp-comment-fields';

    It is generally considered bad practice to hard code slugs, as people can and will change a plugins folder/slug. The preferred method is:
    $plugin_dir = plugin_basename( __DIR__ );

    ref: https://developer.www.ads-software.com/reference/functions/plugin_basename/

    Personally I don’t set it to a var, I use a get_ function to retrieve it as needed.

    As for the initial problem though while I presume the the file exists check and die was intended for nice error reporting, I really think it’d be better to just use require_once() and then allow that to report to the logs what file doesn’t exist.

    If you really do want use include_once + die(), you could still use wp_die() and get a bit better info output, but again seems redundant to just using require. https://developer.www.ads-software.com/reference/functions/wp_die/

    • This reply was modified 3 years, 7 months ago by Jon Brown.
    Plugin Author N-Media

    (@nmedia)

    Hi Jon,

    Thanks for this, we will update our plugin and release with new version ??

    Plugin Author N-Media

    (@nmedia)

    Hi,

    we just updated our plugin with your suggestion and now updated to version 2.0

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Plugin still kills CLI execution’ is closed to new replies.