Skip to content
Read For Learn
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP

Which is best in the following scenario : post_meta vs custom table vs parent/child posts

As you will probably want to eventually do some reporting on the data, e.g. print a temperature average from this month last year in area X, I’d opt for custom tables from the beginning. I’m saying tables, because I don’t see a reason why you wouldn’t put the locations into a custom table as well. If you ever want to do something like calculate distances (and you have the lat & long for your locations stored), this will make your SQL much cleaner and easier to write.

Post meta data isn’t normalized, and will be painful to work with if you have more complex scenarios. It also doesn’t contain useful indexes, as it has no data type associated. This might not be a problem initially, though, as your data set is still quite small.

The only thing FOR meta fields in this scenario is that you could use WP_Query directly and without a lot of hassle. But I’m rather confident that you could add some functionality to wp_query via filters – and you’d have to use those fore advanced stuff anyhow in order to manipulate the auto generated SQL.

That said, it also depends on how quick you (and any other people that might work on it with you) are when developing with a special table vs some pure WP based solution. You could always start with 3, and if the project takes off, you invest a bit more time to make it nice and clean and go for 2. The data conversion shouldn’t be that big of a problem.

Related Posts:

  1. So much data in postmeta
  2. What is the advantage of the wp_options design pattern?
  3. importing data from non-wordpress mysql db
  4. Ordering posts by anniversary using only day and month
  5. Displaying posts with only upcoming dates according their custom field date value
  6. How to add a new meta key and assign timestamp to posts
  7. How do I have WP_Query match posts based on search parameter OR meta fields? (rather than search parameters AND meta fields)?
  8. Ordering posts by custom field named “date” in backend
  9. Unique meta_key with array value vs repeated meta_key with single values
  10. Avoiding ACF get_field and returning to core WordPress function
  11. change order of images attached to post
  12. Diamond question mark in text after migrating content
  13. How to improve my non-unique metadata MySQL entries?
  14. WP Query Args – search by meta_key or title
  15. What is the index [0] for on post meta fields?
  16. Matching Serialized Arrays with meta_query
  17. Custom field metabox not showing in back-end
  18. get_post_meta() unserialize issue – returns boolean(false)
  19. How Can I save multiple records in same meta key?
  20. Edit Custom Database Tables in WordPress
  21. Meta keywords and descriptions plugin for manually editing meta for each page/post
  22. Meta query interfering with orderby relevance
  23. Trying to perform complex custom field query with order by set to field value
  24. What is an efficient way to query based on post_meta?
  25. Up/Down voting system for WordPress
  26. post meta data clearing on autosave
  27. WordPress Search Custom Meta Field Only
  28. Display info from custom fields in all images’ HTML
  29. Loop through two different sets of custom fields
  30. Update meta values with AJAX
  31. Custom fields to save multiple values
  32. Difference between ‘LIKE’ and ‘IN’ in meta queries
  33. Leader board for game on homepage
  34. wp_handle_upload error “Specified file failed upload test” but still creates attachment?
  35. WP_Meta_Query causing long-running MySQL queries
  36. Default WordPress taxonomy (Tag) – How to add a custom field to form and save it to the database
  37. Adding custom fields (post meta) before/during wp_insert_post()
  38. MySQL Query that looks for post with Custom Field, then changes Category
  39. ACF: How to get the full field name (meta_key) by a field key?
  40. post meta getting deleted on save
  41. Custom field not updating when value is empty
  42. meta_compare seems to be treating values as strings instead of integers as expected
  43. Is there any way to get all meta and standard columns for any WordPress object after searching based on meta key and value
  44. Limit the number of acf content when displaying in post loop [closed]
  45. Read / Watch / Listen times – meta
  46. How to add custom metadata text box dropdown to sidebar in Gutenberg editor for all post types
  47. Show values of custom post meta on ‘Add new post’ page?
  48. Custom post meta field effect on the performance on the post
  49. Linking Custom Fields to Database Records
  50. Use meta_query to get title of associated post
  51. Limits, not all post are showen when querying for posts by view count
  52. Display Custom Meta Box Field Only If Value is Present
  53. get posts where a custom field contains a text
  54. WP Query – Is this correct?
  55. Unable to get specific value from post meta
  56. Query post by date (stored custom field meta as yyyymmdd) and differentiate across 12 months
  57. IF Custom field value equals ZERO
  58. Adding custom field and querying from post table
  59. How to use media upload on metabox post page without breaking TinyMCE?
  60. Let’s Create Custom Field Template Documentation
  61. Branch made by several custom values
  62. Looping inside block return
  63. How to copy data from a custom field to the post_content?
  64. WordPress creates new lines in postmeta table on post update
  65. User customising position of WordPress Featured Image
  66. Insert image into sub-field with update_post_meta
  67. How to use conditional statement with custom field
  68. Meta box values are displayed on Custom Fields list. Is it possible to hide them?
  69. Best way to achieve multiple links in a post title
  70. Best way to sort estates and query them (for rent? yes/no. contains office space? yes/no)?
  71. Get author total post votes from post meta
  72. custom filed from post in the side bar
  73. Getting and calculating averge value of custom fields of the same tag
  74. Making WP_Query limit results by date before today where date is a meta_query
  75. multiple meta_query and orderby question
  76. How to display custom fields in hestia theme
  77. Trouble with serialized metadata
  78. How to speed up post list slowed by update_meta_cache()?
  79. WordPress Blocks, setAttributes not saving
  80. SQL query to change the value of a Custom Field
  81. Custom meta POST request fired twice when updating a post in Gutenberg
  82. Add custom field information to source meta data
  83. Update custom field on page specific to logged in user
  84. Delete custom meta
  85. Check if value exists before saving
  86. Get meta value when the page is a blog archive
  87. Populate a select box with data stored in the database?
  88. wordpress simple post multi rating with post_meta and user_meta
  89. wp_postmeta are updated for only one page
  90. Meta_query not filtering posts
  91. Download stuff after filling fields?
  92. Querying meta values within an array
  93. Custom fields / meta box output
  94. Colecting values from custom field checkboxes and displaying them in the post
  95. Build Array from Input Fields question
  96. Dynamic background image used in css after selector
  97. How can i put a custom field inside this php
  98. Site uses wpdb to fetch meta_keys but just displays first meta_key from a page (the post uses the same meta_key “filmmaker” more than once)
  99. Sort posts based on an acf field called fecha value return longtext ‘20240517’
  100. What is the best way to get a different post’s custom field/postmeta with js?
Categories custom-field Tags custom-field, database, meta-query, post-meta
Best way to notify WordPress plugin users of new release candidates for beta testing?
Redirect “Sorry, you are not allowed to access this page.” to Home

Recommended Hostings

Cloudways: Realize Your Website's Potential With Flexible & Affordable Hosting. 24/7/365 Support, Managed Security, Automated Backups, and 24/7 Real-time Monitoring.

FastComet: Fast SSD Hosting, Free Migration, Hack-Free Security, 24/7 Super Fast Support, 45 Day Money Back Guarantee.

Recent Added Topics

  • Bug in translation system: load_theme_textdomain() returns true, files are available and accessible but the language defaults to english
  • Custom Elementor controls not appearing in the widget Advanced tab using injection hooks
  • Get the name of the template/*html file used
  • Trying to Add Paging to Single Post Page
  • Sharing media files between live and staging servers
  • How to display the description of a custom post type in the dashboard?
  • Critical error on image display
  • Copying WP data and files into new install?
  • How to determine the DirectAdmin WordPress backup date?
  • How to get list of ALL tables in the database?
© 2026 Read For Learn
  • Database
    • Oracle
    • SQL
  • algorithm
  • asp.net
  • assembly
  • binary
  • c#
  • Git
  • hex
  • HTML
  • iOS
  • language angnostic
  • math
  • matlab
  • Tips & Trick
  • Tools
  • windows
  • C
  • C++
  • Java
  • javascript
  • Python
  • R
  • Java Script
  • jQuery
  • PHP
  • WordPress