Contents
Advanced Custom Fields - Plugixa Permalink Manager
PRO The custom-field tag %__field_name% puts a field’s value into
an address. On its own it reads the raw stored value, which is right for text
and numbers. The ACF integration makes it understand the fields ACF stores as
IDs.
Using a field in a pattern
Write two underscores and the field’s name between percent signs. For a field
named region on a “Store” post type:
stores/%__region%/%postname%
gives /stores/connacht/galway/ for a store whose region is Connacht.
What each kind of field becomes
| ACF field type | Value used in the address |
|---|---|
| Text, number and other simple fields | The value as stored, cleaned like any address |
| Select, checkbox, radio | The first value chosen |
| Post object, relationship, page link | The related item’s slug |
| Taxonomy | The term’s slug |
| User | The user’s slug |
| True / false | The field’s own name when true, nothing when false |
The true/false rule makes a useful pattern possible: shop/%__featured%/%postname%
puts featured products under /shop/featured/... and leaves the rest at
/shop/....
A field with no value leaves its part of the address out.
Addresses follow the fields
ACF saves its fields a moment after WordPress saves the post. The integration regenerates the address once the fields are in, so an address built from a field shows the value you just saved, not the previous one.
As always, this only applies to items whose update mode lets the address change. A hand-typed or protected address stays put.
Without ACF, or without Pro
%__field_name% is part of the free plugin and reads any custom field as it is
stored. Without this integration a field that stores one related item inserts
its ID rather than its slug, and a field holding several values inserts nothing.