WPThumbs
Themes Plugins By purpose By industry Best-of lists Fix it guides
Free Plugin by wundermatics v1.3.2

Calculated fields for ACF

Simple field math for Advanced Custom Fields.

Calculated fields for ACF

The facts

Rating
4.1★ from 14
Active installs
1k+
Price
Free
Last updated
2 Feb 2022
Added
Dec 2019
Requires WP
4.7
Tested up to
WP 5.9.16
Requires PHP
7.0
Downloads
20,502

Our analysis

AI-assisted

Calculated Fields for ACF is a WordPress plugin that enhances Advanced Custom Fields by allowing users to create formula fields for simple mathematical calculations based on other field values. It updates calculations dynamically via AJAX in the backend post editor and on frontend forms created with the acf_form() function.

This plugin is suitable for users who need to perform calculations within their custom fields, particularly those using Advanced Custom Fields. It supports basic mathematical operations and conditional expressions, making it useful for various applications where dynamic calculations are necessary.

Best for: This plugin is best for developers and site owners using Advanced Custom Fields who require dynamic calculations in their forms.

What it does well

  • Integrates with Advanced Custom Fields
  • Supports dynamic updates via AJAX
  • Allows for complex mathematical and conditional expressions

Where it falls short

  • Requires Advanced Custom Fields 5.0 or later
  • Limited to basic mathematical operations and functions

Verdict

Calculated Fields for ACF provides a straightforward way to add formula fields to custom fields in WordPress, catering to users needing mathematical functionalities. It is a useful tool for those familiar with Advanced Custom Fields.

From the developer

wundermatics's own description of Calculated fields for ACF, lightly tidied.

Adds a formula fields ot Advanced Custom Fields that allows you to perform simple math based on field values. Calculations are updated dynamically via ajax while editing a post on the backend post editor as well as on front end forms.

Requirements

Calculated fields requires Advanced Custom Fields 5.0 or later and works with Pro as well as the standard version.

Frontend forms

Beginning in version 1.2.3, Calculated fields for ACF supports frontend forms created using the acf_form() function (built in to Advanced Custom Fields).

Formulas

Calculated fields adds a new setting “Formula” to the the ACF field editor. Formulas supports referring to other fields in the same Field group using the field name. If a formula is added to a sub field inside a repeater field, the name refers to another sub field in the same repeater.

A sub field inside a repeater field can also refer to a parent field using the “parent.”” prefix.

A formula can contain the basic mathematical operations: plus (+), minus (-), multiply (*), division (/) and power of (^). Formulas can also contains functions like sin, cos, arcsin, log, ln, sqrt, abs. Parentheses are supported.

If an expression can’t be evaluated due to invalid syntax or referring to undefined field names, it will silently return zero.

Examples of valid expressions (note, no equal sign at the beginning):

  • fieldA * 2
  • fieldA * fieldB
  • abs(fieldA) * (2 + sqrt(fieldB))
  • amount * parent.price

Conditional operators

An expression can also contain a conditional expression that will return either 0 or 1. The supported operators are:

  • Equals (==) – Returns 1 when two values are equal, 0 otherwise
  • Not equals (!=) – Returns 1 when two values are not equal, 0 otherwise
  • Greater than (>) – Returns 1 when the first operand is greater than the second, 0 otherwise
  • Greater than or equal (>=) – Returns 1 when the first operand is greater than or equal to the second, 0 otherwise
  • Less than (<) – Returns 1 when the first operand is less than the second, 0 otherwise
  • Less than or equal (<=) – Returns 1 when the first operand is less than or equal to the second, 0 otherwise

Examples of valid expressions using conditional operators:

Read the full description on the official page →

Tagged as

Alternatives

Other plugins for custom content structures.

Ad Inserter

Manage Google AdSense ads, banners, ad rotation, sticky widgets, AMP ads, ads.txt, tracking, header and footer...

Free 300k+ installs 4.9★ (2,428)
Advanced Custom Fields

ACF helps customize WordPress with powerful, professional and intuitive fields. Proudly powering over 2 millio...

Free 2M+ installs 4.5★ (1,438)
Simple Custom Post Order

Easily reorder posts, pages, custom post types, and taxonomies with intuitive drag-and-drop sorting in the Wor...

Free 300k+ installs 4.8★ (569)
WP Activity Log

The #1 user-rated activity log plugin for event logging, activity monitoring and change tracking.

Free 300k+ installs 4.7★ (488)
Custom Post Type UI

Admin UI for creating custom content types like post types and taxonomies

Free 1M+ installs 4.6★ (276)