• Hi,

    It’s great plugin, my suggest add option deny read in front end

    Thanks!

    /**
    * Select categories read
    *
    */

    add_filter( ‘get_terms_args’, ‘restrict_by_category’, 10, 2 );

    function restrict_by_category( $args, $taxonomies ) {

    $user = wp_get_current_user();
    $user_cap = $user->roles;
    $afilter = array();

    $settings = get_option( ‘RestrictCats_options’ );

    foreach ($settings[$user_cap[0].’_cats’] as $value) {
    $afilter[] = $value;
    }

    if ( !is_admin() && !current_user_can(‘administrator’) ) {
    $args[‘slug’] = $afilter; // Array of cat ids you want to show
    }

    return $args;
    }

    • This topic was modified 4 years, 8 months ago by rafagriso.
    • This topic was modified 4 years, 8 months ago by rafagriso.
    • This topic was modified 4 years, 8 months ago by rafagriso.
  • The topic ‘I suggest addition option deny reading on front end’ is closed to new replies.