For serializing and unserializing Data in WordPress, you can use maybe_unserialize and maybe_serialize. If you want to handle the data and add/change values, you could use something like this:
$metaarray = maybe_unserialize(get_post_meta($post_id,'_ait-dir-item',TRUE));
//now $metaarray has an array, if it is serialized. If not, $metaarray has a string.
if(is_array($metaarray)){
$metaarray['mynewfield'] = 'Some text i need to add';
$metaarray['mysecondnewfield'] = array('an' => 'array','i' => 'need', 'to' => 'add');
}
update_post_meta($post_id,'_ait-dir-item',maybe_serialize($metaarray));
Happy Coding,
Kuchenundkakao
Related Posts:
- How do I programmatically add items of content to a custom post type?
- See if the email exists or not
- wordpress form processing to custom post type not working
- How can I remove the “Add New” button in my custom post type?
- Get post ID from wp_insert_post()
- Get Custom Taxonomy ID within loop
- Categories under custom post types doesn’t show properly
- how to use two permalinks for one custom post type
- Clean URL permalink for custom post type
- Inserting data into `post meta` table?
- How to append element after thumbnail
- WordPress tax_input only if logged in
- I am having a problem with form updating/editing WordPress post on the frontend
- Display custom field of specific post where post title matches variable
- Custom Post Type without an archive page
- Show Different Header on a Specific Post ID
- How to auto increment post title & post slug field?
- Custom query to filter posts that have current post as a taxonomy [closed]
- Pagination for custom php code
- Received nothing after executing AJAX post function
- Troubles with saving metabox
- AJAX load more for different custom post type loops
- Changing wordpress publication date to ACF date and time picker date not working
- Cron job for creating posts not excecuting properly
- Why are taxonomy terms not saving when using custom meta boxes with radio button taxonomy selectors?
- creat filter with wp_query
- WordPress custom post type permalink rewrite shows page not found
- Categorize custom post type
- Custom post type editor with dynamic selects, one drop down populating a second second drop down not working
- Function causing the loop display posting more (empty)
- Display latest x posts from all categories in Custom Post Type/Taxonomy
- Post author for revision not being set on update/insert
- Displaying custom field according to date
- Why cant I add a custom post type to a custom taxonomy?
- categories should be available across all custom post types
- Get term name without a foreach loop
- Including all post id’s of a custom post type into an array
- Understanding Post Formats/Custom Post types Etc
- custom post for slider
- Custom Post not working as expected
- Is it possible to add posts and images (auto resize) for custom post types with a script?
- Show current custom taxonomy
- finding and using post type fields in WordPress
- After creating Custom post type by user delete old one
- Is it possible to use array_walk() to append terms to an array of posts?
- How to handle new post from API request?
- get_post_types() can’t get some of my post type
- Creating shortcode id for custom post types
- How to handle this specific case of custom post type?
- How to add new post using a form to categories when categories are using as menu
- Different post title, keywords and description
- post_content is stripping HTML when adding a new post? [closed]
- Querying a custom post type, but not show duplicates
- Menu’s breaking, now showing all page links on site
- Creating on-page options for Custom Post Type
- Post type Echo code is repeating on homepage
- How can I increase the post count for custom post types only?
- How do I call the custom Post Type name and permanent link to my php file?
- Page that lists publications by classifying them by taxonomy
- Is it possible to hide nav menu items only when they are page titles (on specific templates) but not on the dashboard?
- Grouping custom wordpress post types by acf value
- Title and URL Error in Breadcrumb Navigation for Custom Post Types
- I’m having trouble with Related Product “tax_query” ‘terms’ value
- Assigning categories to custom post types via a front-end form; only works for native post type
- Show code dependant on CPT & category
- Adding featured image to a new post using front-end form?
- WordPress – display relationship between blog posts and custom posts
- when looping through custom post data not appearing
- Getting a Post ID to show its content in a Popup
- Custom sorting in post columns by ACF Pro Select Field
- Load info from customposttype into template page
- wp_post_delete is deleting all offices
- Custom Post Type has wrong label and is not found when called by a loop
- Disable Sidebar on certain pages
- current-post-parent for custom post type
- Show parent category and subcategory once in while loop
- Having issue on Loading Meta Data From CSV to CPT
- Published page but it is page not found
- Rewrite URL of Specific Post of Custom Type
- How to get the posts that my following users are liked?
- How to insert post 6 times after user register like ask.fm
- automatic creation of custom post type articles
- Display related post content and custom field content
- The most recent post of custom taxonomy
- Custom 404 redirect for a luddite
- Show tags of custom post types in WordPress
- can’t see categories in appearance-menu-categories
- Meta Box not being added in plugin
- Generate slug and meta data if meta field is empty
- WordPress custom field images not getting inserted into array
- Meta-Box to add multiple items one at a time and on publish save all
- Values inside a custom field to determine which category posts to display
- Posts without featured image using other post’s featured image
- Return all wordpress custom posts in specific multidimensional array
- install.php Custom Taxonomy Term not being added to custom post
- Omitted Content After Post-Publish Insertion
- Building a List of Posts grouped by custom taxonomy as the section header only to be displayed if at least one post is in that tax
- Custom Portfolio String
- Dynamically change Custom Post Type Template OR Change Permalink?
- Store custom post type with JSON content