[wp-trac] [WordPress Trac] #29098: Send JSON success for customize_save and allow response to be filtered

WordPress Trac noreply at wordpress.org
Sun Aug 3 06:20:47 UTC 2014


#29098: Send JSON success for customize_save and allow response to be filtered
-------------------------+----------------------------
 Reporter:  westonruter  |      Owner:
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Future Release
Component:  Customize    |    Version:  3.4
 Severity:  normal       |   Keywords:
  Focuses:  javascript   |
-------------------------+----------------------------
 In my development on the Customize Posts plugin, and on the work
 celloexpressions is doing on Menu Customizer, there is a need to create
 pseudo posts in the preview experience which don't correspond to actual
 posts in the DB. In other words, the IDs used are placeholders which
 aren't finalized until the Customizer settings are saved. Upon saving, we
 need to obtain the IDs that were generated by the DB and then pass them
 back to the frontend so that the model can be updated to utilize the new
 IDs. This currently is difficult because the customize_save Ajax action
 terminates with a `die` without providing a mechanism for returning data
 which plugins can filter to attach any additional information resulting
 from the save. So I suggest that the `save` method return with something
 like:

 {{{
 $response = apply_filters( 'wp_customize_save_response', array(),
 $this->manager );
 wp_send_json_success( $response );
 }}}

 Another key use for this filter would be to send back the PHP-sanitized
 settings and to update the JS models so that they match what was saved to
 the DB.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/29098>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list