Wordpress : switch a term in private

Viewed 7

I'm using Wordpress API REST and made a custom plugin to manage Custom Post Types (in private) and custom taxonomies (linked to the CPT). Nothing insane. BUT : I'd like the terms to be private. I mean : If user_A makes a new term in the 'Rubrique' taxonomy, I don't want user_B to know that it.

Here is my taxonomy registration :

    static public function register()
    {
        register_taxonomy(
            self::SLUG,
            [ListElement::SLUG],
            [
                "label"        => "Rubrique",
                "hierarchical" => true,
                "public"       => false,
                "show_in_rest" => true,
                'capabilities'  => [
                  'manage_categories' => 'manage_rubriques',
            ]
        );
    }

When I register a new term in 'Rubrique' taxonomy, I add the json a status:private and also the user's token on the header... But nothing. A GET Request on wordpress/wp-json/wp/v2/rubrique endpoint let appreas AAALLLLLL terms of this taxonomy...

As far as I searched, I found no way to make a private term on a WP Taxonomy (?). Did I took my problem in the wrong sense ? Is it really not possible ? Shall I create a custom table with all the custom terms and associates them to a post of a specific user (sounds like a gas factory). Is there a simple way to reach my goal ?

Thank you much for your attention. Raffi.

0 Answers
Related