Skip Navigation

[Resolved] Custom Fields conditional display in wp-admin

This thread is resolved. Here is a description of the problem and solution.

Problem: I would like to control the display of fields in wp-admin. I would like to display a single field only on one post type. I would like to display a single field conditionally based on user role. I would like to display an entire field group based on user role.

Solution: Individual field display in wp-admin can be based on other custom field values in the same post, but not User role. The best solution Toolset offers there is you can create a separate field group just for this individual field. Then you can manage that field group display by user role using Access.

This support ticket is created 5 years, 3 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 4 replies, has 2 voices.

Last updated by ethanB 5 years, 3 months ago.

Assisted by: Christian Cox.

Author
Posts
#1313585

I want to display a particular CUSTOM FIELD only for a specific post type called "cards".

My syntax isn't working. Is there a better approach to this goal?
($(wpv-post-type) eq cards)
($([wpv-post-type]) eq cards)

Realted Question: I'd like to display a single CUSTOM FIELD by user type like:
($(user-type) eq Admin)

Second Realted Question: I'd like to filter an entire FIELD GROUP by user type
($(user-type) eq Admin)

Thanks!
Ethan

#1313887

Hi, just to be clear, can you tell me where you are talking about conditional display?
- In wp-admin when creating or editing posts
- In a front-end Form for creating or editing posts
- When displaying the value of custom field(s) in a View or template somewhere on the front-end of the site

#1313929

Hi,
I'm speaking of conditional display for what is seen in the admin

Toolset/ Custom Fields / my-field-group /a-selector-element-for-examle / conditional display / set conditions / add conditon / advanced text mode/

Then something like;
($(wpv-post-type) eq my-post-type)
($([wpv-post-type]) eq my-post-type)

Thank you.
Ethan

#1314025

I want to display a particular CUSTOM FIELD only for a specific post type called "cards".
There's nothing exactly like this built-in to Toolset. Individual custom field display conditions are limited to the values of other custom fields. The best workaround Toolset offers here is to use a separate field group for this field so you can set it to be displayed only on one specific post type. Another solution you might consider requires custom code. You can enqueue a custom CSS file in your theme that hides the field with CSS on all editors except the one custom post type editor.

I'd like to display a single CUSTOM FIELD by user type like:
Again, individual custom field conditions here are limited to the values of other custom fields. The best workaround is to use a separate field group for this field, and set permissions for the entire group in Toolset > Access Control.

I'd like to filter an entire FIELD GROUP by user type
You can filter visibility and editability of entire groups by User role in Toolset > Access Control > Types Fields.

#1315929

My issue is resolved now. Thank you!