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
- Get meta_id along with meta_key and meta_value
- How can merge two arrays values in one array and save in database
- Check if user already visited this post today
- Display all meta for a post?
- Inserting Gravity Form checkbox values into Advanced Custom Fields [closed]
- Conditionally loading JavaScript based on the Advanced Custom Fields in the post
- If Custom Field is empty don’t display div
- How to display multiple Post meta_key/meta_values by SQL query
- the_post_thumbnail() based on the Post ID
- How to use multiple query with same meta key
- How to update single value in multi dimensional Post Meta?
- Is there a reason why my wordpress PHP page isn’t loading into my PHP template
- Conditional statement for parent, child and grandchild pages
- The values of custom fields are not available functions.php
- Why is my get_post_meta always empty
- Compare two meta key values against each other inside the get_posts array?
- How can update custom meta for all posts
- Problem with ACF shortcode with Repeater Field in WordPress? [closed]
- Unique key for each row in a repeater field
- How to Explode a Textarea Field and Echo each line separately, wrapped with HTML
- Advanced Custom Fields Image Field returning ID instead of URL [closed]
- Use ajax to update_post_meta
- Can an array be used as a meta_query value?
- how to increase custom post value by one most efficiently?
- 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]
- Scheduling a post using publish date from a custom field. Resulting post is set as published in the future instead of scheduled
- Remove item from post_meta array via AJAX
- When working with a post, almost all wp_postmeta are deleted
- Make sticky post with FacetWP
- Post Meta statement?
- Generate a radius search of custom post type locations
- WooCommerce Custom Tab with ACF Repeater Field
- Updating Lat and Lng of posts automatically gives sporadic results
- Adding user meta to post meta wp_insert_post() not working
- Ordering / grouping posts by datepicker ACF
- PHP for loop not working as intended
- Position a repeated article blocks
- 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]
- Display a single row from nested array of custom field data
- Efficient way of querying for a “fallback” post?
- Else if Statement for Advanced Custom Fields [closed]
- WordPress AJAX load post metadata in modal
- ACF Images If/else
- get_post_meta with variable
- Post from front end form to post_meta
- Page returning ID from array, how to return the correct values for post in acf wordpress
- Order by in foreach
- Sort by multiple options in custom field
- If or/and statement advanced custom fields [closed]
- retrieve wordpress post-meta using php not wordpress functions
- Postmeta not saving
- Top menu disapears in Category Pages when filtering using ACF
- If custom field doesn’t exist, or exists and it’s true show title?
- ACF loop and php formatting
- get_post_meta is always empty when I use wp_mail
- the_post_thumbnail unless video id is added
- get_category only returning details for ‘uncategorized’
- Custom field within shortcode
- get_post_meta no longer working
- How to add together (get the sum) a field from all author’s posts
- ACF allow zero as a value
- Add comma between variables [closed]
- 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
- ACF | WooCommerce | Theme Development | How to include a /template-part/ that makes use of ACF’s on a custom WooCommerce homepage?
- Metadata on the WP_Post object
- How to display the date under the post title?
- Custom WordPress Function – Adding items from Foreach Loop into an array and Updating Field based on array of IDs (ACF + WooCommerce)
- Show button in header when product custom field is not empty
- advanced custom fields: repeater field within conditional statement [closed]
- How do I get a function to work in single.php
- How can I get values from a custom post type depending on where I click on my SVG map?
- Creating posts with php-script + csv
- How to modify default tags in wp_head()
- ACF number less than comparison not working
- Advanced Custom Fields – How do I get field values of a group within a group field type
- “acf/load_field” Critical error upon saving/updating WooCommerce products [closed]
- How to get ACF field to show up on all posts on front end?
- Put ACF function output code the_terms
- Cannot Access ACF Field Values via my Plugin
- Advanced Custom Fields Auto Populating Field Values For Nested Repeater FIelds
- How to create advanced custom fields for backend content
- Phone number custom field and woocommerce updating issue noticed
- How to capture number input from wordpress form into acf field in woocommerce
- add class to woocommerce single product template gallery thumbnails if media attachment ACF field toggled (true/false)
- Alter main query to always list posts according to ACF number field
- Add css class ID to largest and smallest number a custom field in wp_query
- create custom post type and populate custom fields using php
- Date not working correctly
- Add up all numbers from a WordPress query [closed]
- WordPress per ACF – permalink is not working
- Why does my custom slug only show in Gutenberg editor after page refresh?
- Display posts in correct month order using single date custom field