|
/ Documentation /Apps & Integrations Setup/ How to Update Custom Fields with ACF and MetaBox in OttoKit

How to Update Custom Fields with ACF and MetaBox in OttoKit

This guide explains how to use OttoKit to update custom fields created with Advanced Custom Fields (ACF) and MetaBox plugins in WordPress. Both plugins allow you to create custom fields for posts, pages, users, and options, and OttoKit provides seamless integration to automate updates to these fields.

Overview

Custom fields extend WordPress functionality by allowing you to store additional data beyond the standard post content. With OttoKit, you can automatically update these fields based on triggers like form submissions, webhook data, or scheduled events.

Advanced Custom Fields (ACF) Integration

ACF is a popular WordPress plugin that provides a user-friendly interface for creating custom fields. OttoKit offers six actions to work with ACF fields:

Available ACF Actions

  • Get Post Value – Retrieve custom field values from posts/pages
  • Update Post Value – Update custom field values for posts/pages
  • Get Options Value – Retrieve values from ACF options pages
  • Update Options Value – Update values on ACF options pages
  • Get User Value – Retrieve custom field values from user profiles
  • Update User Value – Update custom field values for users
  • Add Sub Field value in group – Set value for grouped sub-field
  • Update repeater field value – Modify repeater field row data

ACF Field Types

ACF supports various field types, including:

  • Text, Textarea, Number, Email, URL, Password
  • Select, Checkbox, Radio Button, Button Group
  • Repeater and many more

Example: Updating ACF Text Field

Let’s walk through updating a simple text field called “last_modified_by” when a WordPress post is created or updated.

Scenario: Automatically update a custom field to track who last modified a post

Setup in OttoKit:

  • Choose “WordPress” as your trigger
  • Select “Post Created/Updated” as the trigger event
  • Add “Advanced Custom Fields” as an action
  • Select “Update Post Value.”
  • Configure the action:
    Post ID: Use the post ID from the trigger data
    Field Name: Enter “last_modified_by” (the field key)
    Field Value: Map the author name from the trigger data

Result: Every time a post is updated, the “last_modified_by” field will automatically be updated with the author’s display name.

MetaBox Integration

MetaBox is another powerful custom fields plugin that offers advanced features for WordPress developers. OttoKit provides three actions for MetaBox integration:

Available MetaBox Actions

  • Get Object Fields – Retrieve multiple field values from an object
  • Get Meta Value – Retrieve a specific field value
  • Set Meta Value – Update a specific field value

MetaBox Field Types

MetaBox supports numerous field types, including:

  • Text, Textarea, Number, Email, URL, Tel, Password
  • Select, Select Advanced, Checkbox List, Radio, Button Group
  • Switch, Checkbox, Autocomplete, Color, Date, Datetime
  • Time, File, File Advanced, File Input, File Upload
  • Image, Image Advanced, Image Select, Image Upload
  • Single Image, Video, Map, OSM, Background
  • Fieldset, Group, Tab, Divider, Heading, HTML
  • Post, Taxonomy, Taxonomy Advanced, User

Example: Updating MetaBox Text Field

Let’s update a text field called “content_word_count” when a WordPress post is created or updated.

Scenario: Automatically calculate and store the word count of a post in a custom field

Setup in OttoKit:

  • Choose “WordPress” as your trigger
  • Select “Post Created” or “Post Updated” as the trigger event
  • Add the Formatter to remove all HTML tags
  • Add another Formatter app action to count the words in the post
  • Add “MetaBox” as an action
  • Select “Set Meta Value.”
  • Configure the action:
    Object ID: Use the post ID from the trigger data
    Meta Key: Enter “content_word_count.”
    Meta Value: Use the Formatter app to calculate word count from the post content

Result: Every time a post is created or updated, the word count will be automatically calculated and stored in the custom field.

Working with Different Object Types

Post/Page Fields

Both ACF and MetaBox can attach fields to posts and pages. Use these when you need to store additional content information.

Common Use Cases:

  • Product specifications for e-commerce
  • Event details for event posts
  • Author bio information
  • SEO metadata

User Fields

Store additional information about users beyond the default WordPress user profile.

Common Use Cases:

  • Extended profile information
  • User preferences and settings
  • Professional details
  • Social media links

Options Fields (ACF Only)

ACF options pages allow you to create global settings that can be accessed from anywhere in your site.

Common Use Cases:

  • Site-wide settings
  • Contact information
  • Social media handles
  • API keys and configurations

Best Practices

Field Naming Conventions

Use consistent, descriptive field names that indicate their purpose. Avoid spaces and special characters – use underscores instead.

Data Validation

Always validate data before updating fields. Use OttoKit’s conditional logic to check if values meet your requirements before updating.

Batch Updates

When updating multiple fields for the same object, consider using multiple actions in the same workflow rather than creating separate workflows.

Testing

Always test your workflows with sample data before deploying to production. Use WordPress staging environments when possible.

Troubleshooting Common Issues

Fields Not Updating

The most common cause is incorrect field names or keys. Double-check that the field name in OttoKit matches exactly what you’ve defined in ACF or MetaBox. Field names are case-sensitive.

Another frequent issue is targeting the wrong object. Ensure you’re updating the correct post ID, user ID, or term ID. If you’re working with dynamic content, verify that the ID is being passed correctly from your trigger.

Data Type Mismatches

Some field types expect specific data formats. For example, date fields need properly formatted date strings, and number fields require numeric values. Use OttoKit’s Formatter app to convert data types when necessary.

Plugin Conflicts

Occasionally, other plugins may interfere with field updates. If updates aren’t working, try temporarily deactivating other plugins to identify conflicts.

Permission Issues

WordPress user permissions can affect field updates. Ensure that the user context under which OttoKit operates has sufficient permissions to update the fields you’re targeting.

Conclusion

OttoKit’s integration with ACF and MetaBox provides powerful automation capabilities for managing custom fields in WordPress. By following the examples and best practices in this guide, you can create robust workflows that keep your custom field data up-to-date automatically.

Remember to always test your workflows thoroughly and monitor their performance to ensure smooth operation of your automated field updates.

Was this doc helpful?
What went wrong?

We don't respond to the article feedback, we use it to improve our support content.

Need help? Contact Support
On this page
Scroll to Top