[wp-trac] [WordPress Trac] #41273: WP REST API: allow separate add_post_type_support() for post when accessing via REST vs WP Admin

WordPress Trac noreply at wordpress.org
Tue Jul 11 16:27:50 UTC 2017


#41273: WP REST API: allow separate add_post_type_support() for post when accessing
via REST vs WP Admin
-----------------------------+------------------------------
 Reporter:  lougreenwood     |       Owner:
     Type:  feature request  |      Status:  new
 Priority:  normal           |   Milestone:  Awaiting Review
Component:  REST API         |     Version:  4.8
 Severity:  normal           |  Resolution:
 Keywords:                   |     Focuses:  ui, rest-api
-----------------------------+------------------------------
Changes (by lougreenwood):

 * focuses:  rest-api => ui, rest-api


Comment:

 @rmccue sure.

 So, I have a bunch of CPTs, these have various afterSave() methods which
 will automatically save various values into the post fields when a save
 action hook is triggered.

 One of these auto-saved fields in post_title. However, in this scenario, I
 need to disable post_title in wp-admin, but keep access to it using the
 REST API.

 I'm using the Pods plugin to manage these CPTs and IIRC Pods uses
 `add_post_type_support()` to enable/disable post_title etc in wp-admin.

 So, to recap, the scenario is:

 * Multiple CPTs (managed by Pods.io plugin)
 * Disabling post_title for some of these CPTs using
 `add_post_type_support()` or similar
 * Still need to be able to access these fields which are hidden in wp-
 admin using REST

 It seems that your suggestion is a better idea: keeping post_title enables
 but adding a filter to hide in wp-admin:

 >> We may be able to introduce new filters to enable turning off the UI
 without changing the underlying post type support, which would probably be
 a better way to solve this, if it's what you're doing.

 Ideally, this would be configurable on a per-field basis (both built in
 fields and custom fields).

 CC @sc0ttkclark

--
Ticket URL: <https://core.trac.wordpress.org/ticket/41273#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list