Allow plugins to filter _wpCustomizePostsExports js var
entr opened this issue · 7 comments
I realize it may be done simply by placing an additional wp_scripts()->add_data()
but allowing filtering the $exports
seems like a neater approach.
For what purpose? What is the use case?
One might want to modify the 'l10n'
object. I'm aware those are meant to be localized but no good if you need to change the meaning of some items entirely. At least adding stuff to the 'l10n'
should be enough reason I think.
@entr what's an example of a property that you'd want to change? This is supposed to be accounted for already by allowing additional labels
to be supplied in the calls to register_post_type()
. For example if you want to override “Content” to appear as “Name” you can do so by supplying 'title_field' => __( 'Name', '…' )
among the labels
for the registered post type. You can see how this ends up getting used in JS:
OK, that makes perfect sense for the post types. But what about the root l10n
object. I wanted to mod the sectionCustomizeActionTpl
property, but wait a sec. Is that supposed to be part of WP_Customize_Post_Section::json()
in the first place?
It should probably be able to be defined among the labels
of a registered post type as well to override the default.
Yep, that sounds good.
Cool. Want to submit a pull request?