Calculated Fields for ACF supports two different classes of operators, arithmetic and conditional.
Arithmetic operators
The arithmetic operators corresponds to the basic math operators that you are probably already very familiar with:
Operator | Name | Description |
---|---|---|
+ | Addition | Returns the sum of two numbers |
– | Subtraction | Returns the difference between two numbers |
* | Multiplication | Returns the product of two numbers |
/ | Division | Returns the quotient of two numbers |
Conditional operators
An expression can also contain an expression using a conditional operator. Conditional operators will return either 1 or 0 representing true or false. The supported conditional operators are:
Operator | Name | Description |
---|---|---|
== | 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 operand, 0 otherwise |
< | Less than | Returns 1 when the first operand is lower than the second operand, 0 otherwise |
>= | Greater than or equal | Returns 1 when the first operand is greater than or equal to the second operand, 0 otherwise |
<= | Less than or equal | Returns 1 when the first operand is less than or equal to the second operand, 0 otherwise |