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

Custom Post Type meta value is being saved in array, instead of just the string (as value)

Your issue is not with storage, it is with retrieval. get_post_custom() is inconvenient and rarely used in practice.

get_post_meta() is more common in practice. Note it has explicit argument to retrieve a single value, rather than array of values for a key (which WP can do too).

Related Posts:

  1. Get only used meta_values
  2. Get_post_custom not fetching value from array wordpress
  3. How to create content automatically when a post is published?
  4. List Taxonomies: Don’t list taxonomy if it has no post – depending on custom post-meta?
  5. Remove Post Custom Meta Box
  6. Can’t publish custom post type – “You are not allowed to edit this post.”
  7. Custom fields for custom post type
  8. Show future events based on custom field AND order by date
  9. Meta Data for Custom Post Type not saving
  10. Using preg_replace to filter custom textarea
  11. Check if post with same meta value exists
  12. Filter date from post meta when date is in string format
  13. Reworking function for counting custom post type posts count
  14. If Post Meta Equals Current Title Conditional Advanced Custom Fields
  15. Is there a way to exclude posts based on meta_values?
  16. Number of posts in the archive
  17. Custom query for custom post_type
  18. Do posts, pages and / or custom post type objects have unique ID numbers or can there be multiple objects with the same IDs?
  19. Recoverable Fatal Error – Object of class WP_Post could not be converted to string
  20. Archieve.php not loading for custom post type
  21. Submitting Custom Post Types with custom fields from Front-end form
  22. create custom meta box with default value
  23. Get $post->ID from a URL
  24. Displaying a div from an assigned meta_value when on a page
  25. Meta data (Tags and Categories) for Custom Posts not showing.
  26. Display different information of a custom post type
  27. Create Array from custom post type to display a slider
  28. Setting Post Title via Meta Data returns Auto-draft
  29. How to Echo Metadata Value in Currency Format
  30. Issue on Working with Metabox – Checkbox to enable Sale Items
  31. Filter posts by tax (dropdown) and meta value
  32. delete_post_meta() for whole CPT / multiple posts?
  33. How to get specific post meta by title or id
  34. Publish and save specific postmeta to a filtered post_type
  35. populate array with posts
  36. How to Make infinite loop of post
  37. How to move a post to different post type with all meta data?
  38. get_posts seems to be skipping the last Post
  39. Why do I have to press the “Update” button twice to save my meta box values?
  40. Displaying multiple post types on home page
  41. Conflict between wp_list_pages and get_posts – list pages not displaying
  42. How can I display a drop-down select of Post Names
  43. how to show records that don’t have custom meta value
  44. WP API Response does not show my registered metadata
  45. How to detect that the save_post hook is calling the callback associated to the current edit post page only
  46. $post->post_meta not pulling any post in wordpress/php
  47. Values from meta-box not on $_POST
  48. Return number of all custom posts type by author in all statuses
  49. WP_Query of custom post type sorted by meta_key has unexpected results
  50. Returning a custom content types with meta values
  51. Custom post type suddenly stoped working after WordPress 5 update
  52. Batch Extract Date from post title and put into ACF custom field
  53. Is it possible to use array_walk() to append terms to an array of posts?
  54. custom hierarchical taxonomy and custom post type list contains surplus posts
  55. copy images from custom field to another custom field
  56. How to show custom field on specific custom post type posts only when filled
  57. How to handle this specific case of custom post type?
  58. Save CTP post meta different values each day without overwriting previous values
  59. get_post_meta returns NULL in front-end, but correct result in back-end
  60. Cannot obtain custom meta information
  61. Problem with adding custom post type meta to header by plugin
  62. is_main_query() never called on WP 4.4
  63. Group by custom field value (start and end times)
  64. meta query not retrieving posts
  65. How can I output WPAlchemy repeating fields meta values in my page template?
  66. Meta box data is saved but NOT displayed in the meta box text field. Why?
  67. How to call a post’s metadata in shortcode.php?
  68. How to get custom post type title, excerpt, thumbnail and permalink by post ID?
  69. Save Metabox Custom Field Value
  70. Echo custom post meta from options array
  71. Value of post meta dropdown is not showing in WordPress
  72. Meta box data not saving
  73. Get all metadata for a given custom post type
  74. Get posts by category name
  75. WP_Meta_Query object with conditionals
  76. Trying to write shortcode with get_post_meta but isn’t working
  77. Why the_excerpt() function returns excerpt on the Home page and trimmed content in sidebar?
  78. Related posts meta_query CPT
  79. Meta box with front-end styling
  80. Sanitaizing Select Optin For Custom Post Type Metabox in WP
  81. How can I get some of a posts meta data whilst it is still inserting?
  82. How to properly use Categories with Custom Post Types
  83. How to retrive Custom Post Type Meta Fields in Custom WP_Query
  84. Can’t pull posts of a Custom Post Type based on the custom taxonomy of the CPT
  85. Advanced custom field – posted fields from custom post type
  86. Cannot Save MetaBox Data in Custom Post Type
  87. delete duplicate meta_value with same post_id
  88. HM CMB: Post Select Field for CPT ID
  89. Search CPT Title AND Meta
  90. Getting WordPress to store 0 values for custom post type meta
  91. 4 posts per page from single category
  92. updating one custom meta field only
  93. Add a class to post_class if more than one post shares same meta_value_num
  94. Function to return values from metabox
  95. Query custom posts of logged in user only
  96. Add a meta field to the list of results for a custom post type
  97. best way to use custom taxonomy, post type and meta in a job system
  98. Empty meta-box returns publishdate if no value is set?
  99. Say I have a tech blog, how best would I store technical specs for a phone, if i use custom post types
  100. Display a random customposttype2 excerpt in single-custompostype1.php that shares same taxonomy
Categories custom-post-types Tags custom-post-types, get-posts, post-meta
Website that sells statistics
WordPress 4.1 update broke theme

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