• Resolved gruntek

    (@gruntek)


    Hello,
    i tried to use that filter but I struggle how to make it disable history for user role. Could I kindly ask for help?

    // Do not log some post types, for example pages and attachments in this case
    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(
            'page',
            'attachment',
        );
    
        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)
Viewing 1 replies (of 1 total)
  • The topic ‘Exclude user role – WooCommerce Customer’ is closed to new replies.