• Resolved David Wang

    (@blogjunkie)


    I use WooCommerce Subscriptions and it uses a scheduled-action post type to keep track of when subscriptions renew. How can I disable logging for this post type? I looked through the examples on Github but I’m not clever enough to figure out the answer on my own.

    Related idea: scheduled-actions are not visible in the WP dashboard, and therefore are not editable by administrators. It would be great to disable logging by default for posts types that are not public.

    Thank you for a really useful plugin. Cheers

Viewing 1 replies (of 1 total)
  • Plugin Author P?r Thernstr?m

    (@eskapism)

    I’ve added a new example to the examples file.

    
    // Do not log post type "scheduled-action"
    add_filter( "simple_history/log/do_log", function( $do_log = null, $level = null, $message = null, $context = null, $logger = null) {
    
    	$post_types_to_not_log = array(
    		"scheduled-action"
    	);
    
    	if ( ( isset($logger->slug) && ($logger->slug === "SimplePostLogger" || $logger->slug === "SimpleMediaLogger") ) && ( isset($context["post_type"]) && in_array($context["post_type"], $post_types_to_not_log ) ) ) {
    
    		$do_log = false;
    
    	}
    
    	return $do_log;
    
    }, 10, 5);
    
Viewing 1 replies (of 1 total)
  • The topic ‘Ignore post types without UI’ is closed to new replies.