/**
  * Checking WP Admin access
  *
  * @return void
  */
 public static function moove_check_redirect()
 {
     $moove_user = new Moove_User();
     $u = $moove_user->moove_check();
     if ($u['logged_in'] === true) {
         if ($u['wp_admin'] === true || $u['editor'] === true) {
             wp_redirect(site_url('/wp-admin/'));
         } else {
             $redirect_to = esc_url_raw(wp_unslash($_GET['redirect_to']));
             if (isset($redirect_to) && $redirect_to !== '') {
                 wp_redirect(esc_url($redirect_to));
             } else {
                 wp_redirect(site_url('/'));
                 // /my-account
             }
         }
     }
 }
 /**
  * Content protection, returns the trimmed content if is protected.
  *
  * @param  string $content Content string.
  */
 function moove_protect_content($content)
 {
     $moove_user = new Moove_User();
     $u = $moove_user->moove_check();
     $post = $GLOBALS['post'];
     $protection_selected = get_post_meta($post->ID, 'moove_post_protect_data', true);
     if (empty($protection_selected)) {
         $post_type = $post->post_type;
         $options = get_option('moove_post_protect');
         if (isset($options[$post_type])) {
             $protection_selected = $options[$post_type];
         }
     }
     if (!$u['wp_admin'] || !$u['editor']) {
         if (!is_admin() && !current_user_can('edit_posts')) {
             $post_level = moove_post_protection_level($post);
             if (!is_user_logged_in() && !moove_is_public($post) && !moove_is_premium($post)) {
                 $trimmed = wp_trim_words($post->post_content, $num_words = 55, $more = null);
                 $content = $trimmed;
                 $content .= Moove_View::load('moove.protected.truncated.free_membership_restriction');
             }
             if (moove_is_premium($post)) {
                 $trimmed = wp_trim_words($post->post_content, $num_words = 55, $more = null);
                 $content = $trimmed;
                 $content .= Moove_View::load('moove.protected.truncated.premium_membership_restriction');
             }
         }
     }
     return $content;
 }