Hi,
Add this code to your site’s child theme’s functions.php –
function wcfm_custom_capability_settings( $wcfm_capability_options ) {
global $WCFM;
$allowed_article_category = ( !empty( $wcfm_capability_options['allowed_article_category'] ) ) ? $wcfm_capability_options['allowed_article_category'] : array();
$article_categories = get_terms( 'category', 'orderby=name&hide_empty=0&parent=0' );
?>
<div class="wcfm_clearfix"></div>
<div class="vendor_capability_sub_heading"><h3><?php _e( 'Sections', 'wc-frontend-manager-ultimate' ); ?></h3></div>
<p class="wcfm_title catlimit_title"><strong><?php _e( 'Article Categories', 'wc-frontend-manager-ultimate' ); ?></strong></p><label class="screen-reader-text" for="vendor_product_cats"><?php _e( 'Allowed Article Cats', 'wc-frontend-manager-ultimate' ); ?></label>
<select id="vendor_allowed_article_category" name="wcfm_capability_options[allowed_article_category][]" class="wcfm-select wcfm_ele" multiple="multiple" data-catlimit="-1" style="width: 44%; margin-bottom: 10px;">
<?php
if ( $article_categories ) {
$WCFM->library->generateTaxonomyHTML( 'category', $article_categories, $allowed_article_category, '', false, false, false );
}
?>
</select>
<?php
}
function wcfmcap_allowed_article_categories( $allow, $taxonomy, $term_id ) {
global $WCFM;
$wcfm_capability_options = apply_filters( 'wcfm_capability_options_rules', get_option( 'wcfm_capability_options', array() ) );
if( $taxonomy == 'category' ) $taxonomy = 'article_category';
$allowed_taxonomies = ( !empty( $wcfm_capability_options['allowed_' . $taxonomy] ) ) ? $wcfm_capability_options['allowed_' . $taxonomy] : array();
if( is_array( $allowed_taxonomies ) && !empty( $allowed_taxonomies ) ) {
if( !in_array( $term_id, $allowed_taxonomies ) ) {
$allow = false;
}
}
return $allow;
}
add_filter( 'wcfm_allowed_taxonomies', 'wcfmcap_allowed_article_categories', 600, 3 );
Thank You