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

Adding Multiple Values to a Post Meta Key

You can insert an associative array into the post_meta_field.

Here is a quick little function to grab the data afterward (did not test):

function grab_task_name_array($post_id) {
    $new_array = array();
    $array = get_post_meta($post_id,'_task-name'); //do not put true as third parameter (this would return string and not array)
    foreach($array[0] as $key => $value)
     $new_array[$key] = $value;

    return $new_array;
}

If you wanted to store a multidimensional array, some more checks would be needed.

Related Posts:

  1. Get Posts Under Custom Taxonomy
  2. Displaying the category name of a custom post type
  3. Show WordPress Custom Taxonomy Items Based On a Selected Item From Another Custom Taxonomy
  4. Exclude posts that only have the ‘Uncategorized’ category [duplicate]
  5. How are terms connected with posts in database?
  6. Importing data from spreadsheet into wordpress DB, along with custom taxonomies and their terms
  7. get_terms parent for current product only
  8. deleting terms programmatically
  9. How do I get the slug of a custom taxonomy category of a post?
  10. get_the_terms() to show all custom taxonomies
  11. How can I add a meta-box to the posts editor containing all items of a custom taxonomy as checkbox?
  12. Avoid duplicate post from same Taxonomy
  13. Get posts by name and taxonomy term
  14. Set terms in a custom post
  15. Get posts of ONE taxonomy term of custom post type
  16. Choose whether to automatically add a taxonomy with the same name as the post
  17. Setting posts_per_page for taxonomy term template
  18. Force the “Choose from the most used tags” meta box section to always be expanded
  19. Posts list in custom taxonomy
  20. Get Posts Under Custom Taxonomy
  21. How to display posts via custom taxonomy terms using checkboxes?
  22. Saving custom fields to a custom taxonomy
  23. Copy taxonomy terms from one post to another programmatically
  24. Loop parent terms {display posts} AND loop child terms {display posts}
  25. Check if current user has a post and that post has any term/s from a specific custom taxonomy outside the loop
  26. How to associate a custom taxonomy to a post multiple times
  27. Customizing URL slugs of Custom Post Type and Taxonomy make posts/pages 404
  28. Filter By Term Not Working – Custom Post Type
  29. How to get post count including nested categories
  30. Custom Taxonomy From Database
  31. Displaying Results From Custom Taxonomy Query
  32. Multiple loops on a Search result page?
  33. How to get all the terms of a post
  34. Calling Different Custom Post Timestamps in a table
  35. How can I setup a relationship using categories in WordPress?
  36. Is it possible to paste a link without tags and make it directly a link in a post?
  37. sql select for post_title and a term name
  38. How to allow visitors to filter posts by multiple taxonomies
  39. How to add tags (custom taxonomy) to post class css?
  40. How can I hide tags on a child-category page, if that tag has not been used?
  41. Cannot retrieve a custom RSS field from posts
  42. 404 error on default post type and default taxonomy fronted page
  43. How to get Tags with specific post id
  44. How to automate featured posts number? [duplicate]
  45. How do I insert a post with custom post type and relate it to a custom taxonomy?
  46. Display custom taxonomy attached to the post on post single page
  47. outputting posts’ taxonomies: cant get ‘get_the_taxonomies’ working
  48. Customize rel=canonical tag for single blog post
  49. Change all author links in Blog roll
  50. How to I retrieve the ID from the Posts page?
  51. How to save meta checkbox WordPress
  52. Displaying posts that belong to a specific author
  53. Get posts and include taxonomy term
  54. How to calculate the average of a post meta value(Numeric) of a specific author
  55. Is there any way to tell when wp_postmeta has been updated?
  56. Display posts of specific category term
  57. Variable not working in WP_Query
  58. Displaying Custom Taxonomy without a hyperlink
  59. relating business and products with custom taxonomy?
  60. How to Display Posts From Category Within a Custom Taxonomy?
  61. Is there a query string for edit.php to show all posts that have no custom taxonomy terms?
  62. wpColorPicker – problem with implementation to post meta
  63. Form to post new post with custom taxonomies
  64. Get only immediate children (and not grandchildren) of a hierarchical custom taxonomy term
  65. WordPress bulk category select when publishing post
  66. How to add custom meta to ‘pre_get_terms’?
  67. Get Comma Seperated Taxonomy Linked Terms and Last Child Separated By “&” Instead Of Comma
  68. How to show a custom taxonomy in the theme?
  69. How to filter custom taxonomy term name, slug, and description?
  70. Change post author without using wp_update_post()
  71. How to group all terms children’s in custom taxonomy?
  72. Hierarchical taxonomy list with modificated term links
  73. if in category but only with post meta
  74. WP Job Manager plugin – Listing only the twelve job categories on frontpage order by jobs they have
  75. Show template part if part of term
  76. Parent category / child category posts
  77. wp_query with ajax
  78. one post per term taxonomy
  79. wp_set_object_terms NOT working on CPT, but wp_set_post_terms does
  80. Update post meta within save_post action
  81. How can I change the output display of my pagination?
  82. Exclude product attributes from taxonomy terms loop
  83. Display post number by category
  84. Updating post meta for checkbox
  85. Saving Post Data in Another Database
  86. Only allow posts with a specific term to only be viewed by other authors with the same term in their post
  87. Corrupted nav-menu?
  88. Get name of taxonomies of current page
  89. Programatically adding custom filters to post list
  90. Count the number of a post types associated with another post type
  91. Custom permalink for each post
  92. List Top 5 taxonomy terms based on number of post
  93. How can I tell if a post has been published at least once?
  94. Is there a way getting post fields using `transition_post_status`
  95. Automatic blog page with custom design [closed]
  96. Add multiple meta keys to a post at once
  97. Show number of posts by logged in user
  98. How does WP decide how to display a page
  99. Unable to differentiate between two categories under custom post type on single.php
  100. Copy/Move selected taxonomy terms to another taxonomy for posts
Categories posts Tags custom-taxonomy, post-meta, posts, taxonomy, terms
Splitting the main query in multiple loops with query_posts and/or pre_get_posts?
Retrieving Google Plus share count with wp_remote_post

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