Skip to content

Instantly share code, notes, and snippets.

@ko31
Created August 1, 2019 02:47
Show Gist options
  • Select an option

  • Save ko31/4892a0a1d75bbdfb6f77e645f542cc90 to your computer and use it in GitHub Desktop.

Select an option

Save ko31/4892a0a1d75bbdfb6f77e645f542cc90 to your computer and use it in GitHub Desktop.
WooCommerce サイトで予約投稿が実行されているかログを取った時に使ったプラグイン
<?php
/*
Plugin Name: デバッグ用
Description: WooCommerce サイトで予約投稿が実行されているかログを取った時に使ったプラグイン
Author: ko31
Author URI: https://go-sign.info
*/
add_action( 'publish_future_post', function( $post_id ) {
if ( function_exists( 'wc_get_logger' ) ) {
$logger = wc_get_logger();
$context = [ 'source' => 'my_debug' ];
$logger->info( 'publish_future_post post_id=' . $post_id, $context );
}
}, 11, 1 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment