If you need to search by your meta_key
/meta_value
then do not store them in a single key. If you store as a single key then you are going to have to store your data as serialized
string, or something similar. The only way you can search that would be via an inefficient %LIKE%
query which would also probably be prone to error. Something similar is true if you need to sort queries on any of your values. You can’t get any reasonable kind of human-like alphabetical or numeric sorting out of a serialized string. If you expect you might need to do any manipulation at the database level, store as individual meta_keys
.
If, however, all you will ever need is to pull the data by the meta_key out of the database as a monolithic block you should be fine.
Related Posts:
- Update all posts automatically when using post_meta
- Get updated meta data after save_post hook
- Change post format using custom field
- Sanitizing `wp_editor();` Values for Database, Edit, and Display
- What Is meta_id In wp_postmeta?
- Add custom field automatically (add_post_meta) with value based on number of words of article
- How can I sort posts by the date and a custom meta field?
- Get Meta Key Value While Saving Post
- Updating post data on save (save_post vs wp_insert_post_data)
- Cannot retrieve a custom RSS field from posts
- Hooking into the post editing screen for an existing page only
- Customize rel=canonical tag for single blog post
- How to I retrieve the ID from the Posts page?
- Change post author without using wp_update_post()
- if in category but only with post meta
- Update post meta within save_post action
- Saving Post Data in Another Database
- Add multiple meta keys to a post at once
- saving/reading custom field value does not work – no value gets POSTed
- Post meta not working
- Get Category in save_post Hook
- How do you update post date (year only) in a separate custom field?
- WP_Query sort by meta_value_num or date
- Grab meta data before post is saved
- Creating Ordered Query using Meta_key
- How enter custom post meta or custom field on box post list archive page?
- How to check if post meta key exists or not in wordpress database
- Action hook ‘wp’ firing twice… why?
- Disallow a user to post in certain categories
- In what sequence are the hooks fired when a post is “published”?
- Check before publishing, if already exist post with current custom field value
- post meta data clearing on autosave
- meta_box or custom_field as a second tinymce post-instance?
- Display info from custom fields in all images’ HTML
- Create A Metabox For A Custom Field
- WordPress Delete hook with wp_delete_post function?
- Paragraphs removed when using get_post_custom()?
- Get the post_id of a new post
- Does WP get all post_meta on POST page?
- First hook to use current page post id
- Populating a page with content from post custom fields
- How can I hook into creating a new post and execute wp_die(), before the post is inserted into the database?
- Does an action fire when adding a tag via the “Tags” meta box?
- Custom fields on a virtual page
- Get a custom field of all posts on current blog page
- Are posts updated or built from revisions + autosaves?
- How to permanently delete a post meta entry?
- How can I get a post field value using javascript?
- Automatic value for custom fields for posts
- Action hook for new pending posts?
- Hide a specific category in admin All Posts page (WordPress)
- Force the “Choose from the most used tags” meta box section to always be expanded
- Automatically add custom fields value to wordpress post
- Meta value does not save for scheduled posts
- MySql query to get posts with all meta and terms
- How to compare two posts including their meta fields on a scalable base?
- Is it possible to paste a link without tags and make it directly a link in a post?
- Copy post to separate database with “add_action(….)”
- How to automate featured posts number? [duplicate]
- How to save meta checkbox WordPress
- Allow only one post with specific meta value
- How to calculate the average of a post meta value(Numeric) of a specific author
- How to validate select field in post meta?
- wpColorPicker – problem with implementation to post meta
- Is it possible to add a shortcode below post title?
- Automatically set post_parent value
- Add two custom fields as a default to the “new post” page.
- Custom permalink for each post
- Is there a way getting post fields using `transition_post_status`
- Why my meta boxes won’t show in front post page?
- Will multiple category descriptions effect my search engine optimization?
- Automate post update for all posts?
- Conditionally run function based on custom meta value?
- What snippet do I need to type to show my ACF field show up on my theme?
- Is there a way to make [Table Of Content] plugin while not using revision data?
- Only the most recent post is showing on my category page (working on localhost, not live site)
- Post picker custom field on page
- Featured Images most often doesnt appear
- Is there a way to know when a page has been updated and do some action only once?
- How to bulk Update URLs to new values?
- Hook when post is set from published to draft?
- Issue migrating a checkbox-type meta field to the block editor
- How to retrieve all meta data directly from the $post object? Such as $post->related_topics?
- Auto populate custom fields by post date
- Best Way to detect unique posts in wp rest api
- ACF Relationship – Get Parent’s Post Object
- post_name is not stored until post is published… where should I store my slug until it goes live then?
- wp query custom orderby not custom field
- How to retrieve a post by inputing the url in a custom field and displaying it on an options page
- Custom fields in normal posts
- Show posts between two Custom Fields date
- Ordering posts alphabetically by meta keys and title
- Checking if some condition is matched before inserting post into database
- Where should get_post_meta() go to get $post->ID get_post_meta() is empty and $post->ID & get_the_id() are working
- get_post_meta property of non object
- Which hooks are essential for post templates?
- How to make a local “scroll to ID” on post?
- If meta_key exists then don’t select this post?
- Site ‘Categories’: save an admin global setting with post metadata [closed]
- Image inside the content is replaced with featured image from my older post