Arrays are serialized by default, so just do
update_post_meta($my_post, 'ganalytics_settings', $ganalytics_settings);
https://codex.wordpress.org/Function_Reference/update_post_meta
$meta_value (mixed) (required) The new value of the custom field. A
passed array will be serialized into a string.(this should be raw as
opposed to sanitized for database queries) Default: None
Also, make sure that $my_post
is post ID, not the post object.
And, if you want to update ACF field, you should use it’s update_field
function.
https://www.advancedcustomfields.com/resources/update_field/
Related Posts:
- How to update custom fields using the wp_insert_post() function?
- Display all values of custom a field created with ACF on a page
- Display all meta for a post?
- Conditionally loading JavaScript based on the Advanced Custom Fields in the post
- If Custom Field is empty don’t display div
- Is there a reason why my wordpress PHP page isn’t loading into my PHP template
- The values of custom fields are not available functions.php
- Problem with ACF shortcode with Repeater Field in WordPress? [closed]
- How to Explode a Textarea Field and Echo each line separately, wrapped with HTML
- how to increase custom post value by one most efficiently?
- Advanced Custom Fields: Post Object – Not returning data [closed]
- How to Display Image Meta underneath EVERY image in EVERY post
- ACF: Only get first row of a Repeater Field
- Importing hard coded custom field into acf field
- Get Current User Id Inside a Loop Returns 0 For a Shortcode
- Strip characters, Including spaces, for tel: link
- How can I add multiple ‘tax_query’ arrays via a loop?
- Change output based on text field value
- Using Advanced Custom Fields to create a per page slider
- Randomly Assign an Image’s Alt Text Based on Data From Post
- Advanced Meta Query for Large Calendar Website (12k+ posts) (175k+ wp_postmeta rows)
- Display PHP within HTML values
- Saving an array of dynamic repeater data as post_meta
- Unread Repeater field IMG alt not working
- Unable to write multiple values back to ACF user field – PHP
- Update grandchild repeater field with value per row
- Slick + PHP + ACF + JQuery slide reveal not working
- WordPress update_post_meta updating with empty meta_value field [closed]
- Sort by page information by Ascending Numbers
- Advanced Custom Fields not displaying
- Non-Closing PHP Query in WordPress Loop
- Download PDF after CF7 form submission
- How to create an ACF shortcode with Repeater Field in WordPress? [duplicate]
- Querying Database with wpdb
- update_post_meta only updating on last loop of foreach
- how to get serialized post meta
- Form search query – displaying ACF “Post Object” field as results
- InnerBlocks with allowedBlocks not working with acf_register_block
- Accessing values from ACF sub field (flexible content area) in PHP
- Creating an image from a custom field
- Can I set up a hover animation in CSS depending on a PHP conditional?
- Get ACF options field in PHP acting as CSS
- Conditional multidimensional arrays and array_map
- How can I count ACF sub_field with a certain value
- How to add post meta in while loop?
- Add category to post meta
- Problem with adding custom CSS class to image in ACF Photo Gallery plugin [closed]
- Advanced Custom Fields [closed]
- Order a WP_Query by meta value where the value is an array
- Add a custom class to the body tag using custom fields
- Unable to Call More than One Meta Box Output
- Hide a div when a custom field is empty
- Get All In One SEO Pack to use custom field instead of Content
- Post meta select input, if statement
- WordPress stripping out custom field tags
- Display Post Title From Select Choice Loop in Advanced Custom Fields (ACF) – WordPress
- Add class to all img if they have a certain ACF field
- Problems updating nested ACF field groups
- Bootstrap 4 Carosuel with ACF Repeater field
- How to update custom fields when post is published?
- Update Images after edit via php
- How to display acf field values from home page on all pages?
- Set ACF on order during checkout
- No more get_option(‘date_time’) in WordPress 5.5?
- Delete post meta by serialized meta value
- Advanced Custom Forms PHP formatting for do_shortcode
- Get field value and use as variable in php
- ACF Gallery field images donwload
- Show a text if the post has written by author user role in WordPress
- ACF under category name in shop page [closed]
- get_template_part() not working with Advanced Custom Fields plugin
- List all ACF field values across every post on one page
- Javascript Tab Gallery with Advanced Custom Fields
- WP post meta – for loop inside for loop
- PHP/CSS: Shortcode won’t display correctly, and only displays in the head (before content)
- ACF background-color per post in a WordPress loop
- Reverse Cross-Sells (WooCommerce)
- How can I copy an ACF field to AIOSEO field? [closed]
- Remove item from post_meta array via AJAX
- Make sticky post with FacetWP
- Post Meta statement?
- Generate a radius search of custom post type locations
- WooCommerce Custom Tab with ACF Repeater Field
- PHP for loop not working as intended
- Is there a reason why my wordpress PHP page isn’t loading into my PHP template
- ACF + WP + Slick Slider Repeater Slide Group PHP not Displaying [closed]
- Else if Statement for Advanced Custom Fields [closed]
- WordPress AJAX load post metadata in modal
- get_post_meta with variable
- Postmeta not saving
- ACF loop and php formatting
- get_category only returning details for ‘uncategorized’
- Custom field within shortcode
- How to add together (get the sum) a field from all author’s posts
- ACF allow zero as a value
- ACF Date fileds to Age Convert [closed]
- Advanced custom fields Repeater conditional statement not working [closed]
- Order woo products, but first products must be with acf fields
- Show button in header when product custom field is not empty
- advanced custom fields: repeater field within conditional statement [closed]