[wp-trac] [WordPress Trac] #24696: Support for custom $meta_types with update_metadata()
WordPress Trac
noreply at wordpress.org
Sat Jul 6 01:31:19 UTC 2013
#24696: Support for custom $meta_types with update_metadata()
-------------------------+-----------------------------
Reporter: GaryJ | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version:
Severity: normal | Keywords:
-------------------------+-----------------------------
`update_post_meta()` is a simple wrapper for `update_metadata()` with a
first param of `post` as the `$meta_type`. `update_metadata()` has some
dynamically named filters which use this `$meta_type`, so if you've
registered a CPT of dog, then it would nicer to allow a function to run
against `update_dog_metafilter`, than the more heavily hit
`update_post_metafilter`. This would be done by calling
`update_metadata('dog' ...)` instead of `update_post_meta()`, and would
save the function interfering in *all* postmeta table saves.
The constraint here, is that the `_get_meta_table()` returns false if a
`*meta` table doesn't exist. If it could fallback to using `postmeta`
table instead, then you could separate the name of the filters away from
the table it's being saved to (logic layer tied in to the storage layer),
and have it associate with the object type instead.
There may well be other consequences I've not discovered yet, and the
suggestion would apply to `delete_metadata()` and other friends as well.
The end result would be that:
* **Object Type** - **Filter Name** - **Table**
* post - update_post_metdata - postmeta
* user - update_user_metdata - usermeta
* comment - update_comment_metdata - commentmeta
* dog - **update_dog_metdata** - postmeta
* listing - **update_listing_metdata** - postmeta
Rather than:
* **Object Type** - **Filter Name** - **Table**
* ...
* dog - update_post_metdata - postmeta
* listing - update_post_metdata - postmeta
which is what's currently required.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/24696>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list