• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • We are looking for U.S.-based freelancer or agency working with SEO or WordPress for a quick 30-min interviews to gather feedback on XOVI, a successful German SEO tool we’re looking to launch in the U.S.
    If you qualify and participate, you’ll receive a $30 Amazon gift card as a thank-you. Please apply here. Thanks for helping shape a better SEO product for agencies!
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

Input Executing WordPress plugin/theme cron events through WP-CLI

wwwAndries

New Pleskian
PRODUCT, VERSION, OPERATING SYSTEM, ARCHITECTURE:
WordPress Toolkit 3.5.0 >

PROBLEM DESCRIPTION:
WordPress plugin/theme cron events are executed through WP-CLI, cron event is removed after executing and reporting status is success, but the plugin/theme "do_action" is actually never excuted.

STEPS TO REPRODUCE:
I’ve disabled the wp-cron for all of the sites I’am managing and use the system cron to run WP-CLI commands like:

${WP_CLI} -instance-id ${INSTANCE_ID} -- cron event run --due-now --url="${WP_SITE_URL}" &>> $CWS_TMP_FILE

The "due-now" cron events were executed and returned success status after executing, but the plugin/theme action/filter never executed. In the WordPress plugin.php the function “do_action_ref_array” was executed but the global $wp_filter[ $tag ] was NULL.

function do_action_ref_array( $tag, $args ) {
global $wp_filter, $wp_actions, $wp_current_filter;

if ( ! isset( $wp_actions[ $tag ] ) ) {
$wp_actions[ $tag ] = 1;
} else {
++$wp_actions[ $tag ];
}

// Do 'all' actions first
if ( isset( $wp_filter['all'] ) ) {
$wp_current_filter[] = $tag;
$all_args = func_get_args();
_wp_call_all_hook( $all_args );
}

+ if ( ! isset( $wp_filter[ $tag ] ) ) {
+ if ( isset( $wp_filter['all'] ) ) {
+ array_pop( $wp_current_filter );
+ }
+ return;
+ }

if ( ! isset( $wp_filter['all'] ) ) {
$wp_current_filter[] = $tag;
}

$wp_filter[ $tag ]->do_action( $args );

array_pop( $wp_current_filter );
}

Because of that, the function returned without an error and WP-CLI reported success, but the $wp_filter[ $tag ]->do_action( $args ); was never executed!

Plesk changed there wrapper for WP-CLI last year and added “skip-plugins: true” and “skip-themes: true” in the wp-cli.yml. Every WP-CLI command is executed without loading plugins and themes. This is the reason why $wp_filter[ $tag ] was NULL and the plugin/theme action/filter was never executed.

Tempory solution
After adding “--skip-plugins=dummy-plugin” at the WP-CLI command “cron event run --due-now”, all scans run fine.


EXPECTED RESULT:
When executing ${WP_CLI} -instance-id ${INSTANCE_ID} -- cron event run --due-now --url="${WP_SITE_URL}", I expect that the cron events of the core, plugins and themes are run.

ANY ADDITIONAL INFORMATION:

YOUR EXPECTATIONS FROM PLESK SERVICE TEAM:
I would expect that skip-plugins and skip-themes would be false because this is the default WP-CLI behavior. At least document this deviation.
 
Back
Top