[wp-trac] [WordPress Trac] #18979: Add $post_type parameter and a filter to meta_form()
WordPress Trac
wp-trac at lists.automattic.com
Sun Apr 1 12:29:55 UTC 2012
#18979: Add $post_type parameter and a filter to meta_form()
--------------------------+------------------------------
Reporter: takayukister | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Editor | Version:
Severity: normal | Resolution:
Keywords: |
--------------------------+------------------------------
Changes (by michelwppi):
* cc: contact@… (added)
Comment:
Just a short contribution to improve - old - meta_form() function
according filtering and protecting rules of meta_key and custom post type:
In current post_custom_meta_box (displaying custom form fields), list_meta
is filtered via is_protected_meta function (and his own available filter
'is_protected_meta'). But it is impossible to filter the content of the
popup list populated by $key built by meta_form().
With 'is_protected_meta' filter it is possible to subselect metas
according context. To subselect popup menu , I suggest a very simple
filter just before
{{{
<td id="newmetaleft" class="left">
<?php if ($keys){
}}}
{{{
<td id="newmetaleft" class="left">
<?php
$keys = apply_filters( 'post_meta_key_subselect', $keys);
if ($keys){
}}}
Inside the filter, it will be easy to re-query keys (l''ike described
above by takayukister'') or to subselect and sort the popup list according
context an rules (post_type, and more...) without rebuilding a whole
custom field metabox UI. It is also a simple way to fixe contamination of
keys used buy one post type in another.
This very simple improvement is in concordance with the available filter
'is_protected_meta' where it is possible to not only subselect key with
prefix '_' but with another rules.
Hope that help to review.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/18979#comment:2>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list