DescriptionUpdates the value of a specific field. Show Parameters
Return(bool) True on successful update, false on failure. ExamplesUpdating via field nameThis example shows how to update the value of a field called ‘views’ on the current post being viewed.
Updating via field keyThis example shows how to achieve the same result as above using the field’s key instead of its name. The field’s key should be used when saving a new value to a post (when no value exists). This helps ACF create the correct ‘reference’ between the value and the field’s settings. Each value saved in the database is given a ‘reference’ of the field’s key. This allows ACF to connect a value with its field. ACF does this so it can format values when loaded based of the field type and settings. For example, the image field contains a setting to return an array of image data instead of the attachment ID.
Update a value from different objectsThis example shows a variety of $post_id values to update a value from a post, user, term and option.
Saving values to a new post.This example will demonstrate how to create a new post, and save multiple field values to it.
NotesNo change detectedIf the value passed to this function is the same as the value that is already in the database, this function returns false. Related Basic: get_field() Functions: delete_field()OverviewThis guide will discuss how to update the Advanced Custom Fields (and PRO version) plugin on your website. Updates can be applied by either of the two methods shown below. One click updateThe Advanced Custom fields plugin can be updated via the ‘Plugins’ page found in your WordPress website admin area. Updates will appear when available and can be applied by simply clicking on the ‘update now’ button. This method of update is also available for ACF PRO, however, you will also need to activate your license. This is easily done via the ‘Custom Fields -> Updates’ admin page. If your license has not been activated and an update is available, you will be notified when viewing the ‘Plugins’ page. Manual updateYou may also apply plugin updates manually by copying and pasting the plugin files into your ‘wp-content/plugins’ folder. You can download the Advanced Custom Fields plugin files from the WordPress repository page and the ACF PRO plugin files from your account online. There is no loss or change to data whilst modifying the plugin’s files making it safe to delete and re-upload the plugin folder. NotesSome updates may trigger a prompt to upgrade the DB. The logic to check if a DB upgrade is required will run in the admin area after a new version number is detected, therefore, it is fully compatible with both the update methods listed above. Related Guides: How to activate |