Php 如何在WP Admin中筛选分类术语?

Php 如何在WP Admin中筛选分类术语?,php,wordpress,taxonomy,Php,Wordpress,Taxonomy,我试图在wordpress站点的后端筛选自定义分类法,以允许某些用户仅使用部分可用条目。 通过Advanced Custom Fields插件,我在用户面板中创建了一个自定义元框,允许我随意禁用或启用自定义分类中现有的术语列表(WP_术语)。 但是现在我只需要在WordPress post编辑器中显示从用户页面选择的术语。 这是我迄今为止提出的代码,但似乎我搁浅了 function filter_admin_allowed_regions ( $terms, $id, $taxonomy ) {

我试图在wordpress站点的后端筛选自定义分类法,以允许某些用户仅使用部分可用条目。
通过Advanced Custom Fields插件,我在用户面板中创建了一个自定义元框,允许我随意禁用或启用自定义分类中现有的术语列表(WP_术语)。
但是现在我只需要在WordPress post编辑器中显示从用户页面选择的术语。 这是我迄今为止提出的代码,但似乎我搁浅了

function filter_admin_allowed_regions ( $terms, $id, $taxonomy ) {
    $terms = wp_cache_get( $id, "{$taxonomy}_relationships_sorted" );
    $newTerms = array();
    if(is_admin())
    if ( $taxonomy->name == "regioni" ) {
        $allowed = the_field('tassonomie_abilitate', 'user_'.get_current_user_id());
        return $allowed;
    }
    return $terms;
    }
    add_filter( 'get_the_terms', 'filter_admin_allowed_regions' , 10, 4 );

“但似乎我搁浅了”可能在海盗中被称为“问题描述”,但在这里不是。请阅读。
_字段将回显该字段。如果要返回,您需要
get_字段
。我喜欢Broe的描述和描述。“海盗间的问题描述”,哈哈。。。霍华德是对的,
_字段
将您的代码放在了一起:)