简体   繁体   中英

WordPress - Toggle metabox visibility on post type edit screen using Gutenberg and its REST_API

I have some difficulties to interact with my metaboxes using REST_API.

In a post type, I have a taxonomy called JOBS (with terms like webdesigner , developer , seo , etc.) and each job has its own taxonomy ( Webdesigner , Developer , Seo , etc.).

Now I want to show the metabox of the job taxonomy only when the term of the job is checked in the JOB taxonomy.

Example: When I check the term "Webdesigner" of the JOBS taxonomy, I want to show the metabox of the Webdesigner taxonomy.

Have you an idea how to do that?

Thank you: :)

You can use JavaScript to toggle the taxonomy meta boxes based on some attributes (class, id...) that you can map these 2 types of taxonomies.

If you don't have enough data in the HTML output of the taxonomy meta boxes in which you can map them together, then you can search for the hook (or filter ) that runs when displaying the HTML markup of a meta box to add for example an attribute that contains the IDs of the associated terms of the other taxonomy.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM