[wp-trac] [WordPress Trac] #61695: Suggestion: Add a post_type column in the wp_postmeta table

WordPress Trac noreply at wordpress.org
Thu Jul 18 16:44:01 UTC 2024


#61695: Suggestion: Add a post_type column in the wp_postmeta table
-------------------------------+-----------------------------
 Reporter:  rajinsharwar       |      Owner:  (none)
     Type:  enhancement        |     Status:  new
 Priority:  normal             |  Milestone:  Awaiting Review
Component:  Posts, Post Types  |    Version:
 Severity:  normal             |   Keywords:
  Focuses:                     |
-------------------------------+-----------------------------
 **An Enhancement:** I am wondering if we can add a post_type column in the
 wp_postmeta table. This would allow us to query for the mey keys using the
 post_type column, instead of querying each individually with post_ids.

 A simple use case is, I was building a contact list plugin. There, I had a
 CPT of "my_emails". Now, in that CPT, there were multiple meta fields of
 "email", "first_name", "last_name" etc. Now to fetch all the meta fields
 of "email", I need to query through the whole wp_postmeta table to find
 instances of "email" meta_key. It would have been much easier and faster I
 believe if we could have a post_type column as well in the table, which
 tells the post_type that meta is of.

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


More information about the wp-trac mailing list