# ACF - Advanced Custom Fields

Advanced Custom Fields (ACF) is one of the most popular plugins for adding custom fields to User, Post, and Taxonomy objects in WordPress. It is highly recommended.

1. [Enable Frontend Post Type Editing](#post-type)
2. [Enable Non-ACF Post Type Editing](#non-acf-post-type)
3. [Custom Post Type Capabilities](#post-type-capabilities)
4. [Enable Frontend Taxonomy Editing](#taxonomy)
5. [Enable Non-ACF Taxonomy Editing](#non-acf-taxonomy)
6. [Custom Taxonomy Capabilities](#taxonomy-capabilities)
7. [Custom Capabilities: Use Case & Caution](#capabilities-caution)
8. [Field Group Location](#user-fields)
9. [Custom User Fields](#user-fields)

***

#### Download:&#x20;

{% hint style="success" %}
The Advanced Custom Fields plugin is available for free at:

* Official ACF Website [https://www.advancedcustomfields.com/download/](https://www.advancedcustomfields.com/download/)
* WordPress Plugin Repository [https://wordpress.org/plugins/advanced-custom-fields/](https://wordpress.org/plugins/advanced-custom-fields/)&#x20;
{% endhint %}

***

#### Documentation&#x20;

[https://www.advancedcustomfields.com/resources/](https://www.advancedcustomfields.com/resources/)

***

#### Enable Frontend Post Type Editing: <a href="#post-type" id="post-type"></a>

In the Edit Post Type screen, enable the "**Show UI Frontend**" option.

<figure><img src="https://2226487161-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqVWDZMetj6mBqmoSajgK%2Fuploads%2FIH2vAkkT8jaNAi8fdo7N%2F9675522123.png?alt=media&#x26;token=50448f69-398a-4c42-8667-7a834d135bc3" alt=""><figcaption><p>Enable "Show UI Frontend" option.<br></p></figcaption></figure>

<figure><img src="https://2226487161-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqVWDZMetj6mBqmoSajgK%2Fuploads%2FNsXwP8ZzfOGH2ywoUVqh%2F2822923945.png?alt=media&#x26;token=a74b7403-b4a8-4c91-8214-0de2c9c2b6b0" alt=""><figcaption></figcaption></figure>

***

#### Enable Non-ACF Post Type Editing <a href="#non-acf-post-type" id="non-acf-post-type"></a>

For any custom public post types that are not created using ACF, navigate to: **Customize > Theme Options > Public Post Types**, here, you can enable them as needed.

***

#### Custom Post Type Capabilities <a href="#post-type-capabilities" id="post-type-capabilities"></a>

ACF and most Custom Post Type UI plugins do not support configuring the "capability\_type" parameter, which is essential for role-based content management. By default, "capability\_type" is set to "post", meaning it inherits the same permissions as the default WordPress post type.

**Example:**

_If you register a "Photo" custom post type and want only specific user roles to manage it (e.g., Add, Edit, or Delete actions), you must explicitly define the "capability\_type" parameter. Otherwise, it will default to "post", allowing any regular author to manage the Photo post type, which may not be the intended behavior._

We have chosen not to automatically alter this behavior, even though it could be done easily. Instead, we leave it up to you to configure the settings as needed, giving you more flexibility rather than imposing restrictions.

If you want to assign custom capabilities to your post type instead of inheriting the default post capabilities, you can add the following code snippet to the end of **wp-content/themes/streamtube-child/functions.php** or your own plugin and change the $my\_post\_types value as desired.

{% embed url="https://gist.github.com/nttoanbrvt/901f14c9c413e3f9509aa0c6f6b3eef2" %}

After adding the code, you may not see the custom post type editing screens in the frontend Dashboard, even if you are logged in as an admin. This happens because the necessary capabilities have not been assigned yet.

You will need to assign capabilities as outlined here [content-capabilities](content-capabilities "mention")

***

#### Enable Frontend Taxonomy Editing: <a href="#taxonomy" id="taxonomy"></a>

Using the same approach as with post types, you can also enable the "Show UI Frontend" option for custom taxonomies.

<figure><img src="https://2226487161-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqVWDZMetj6mBqmoSajgK%2Fuploads%2FlBno6IaJj2tJvXkeBSPH%2F2991158490.png?alt=media&#x26;token=69b31b98-3000-4d2c-ae13-e2d1060f027e" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2226487161-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqVWDZMetj6mBqmoSajgK%2Fuploads%2FdA9V4G2bmqzxCEoM8aRE%2F4091120127.png?alt=media&#x26;token=5ef5e76b-486b-4641-bd77-63be5ea3ce1f" alt=""><figcaption></figcaption></figure>

***

#### Enable Non-ACF Taxonomy Editing <a href="#non-acf-taxonomy" id="non-acf-taxonomy"></a>

For any custom public taxonomies that are not created using ACF, add the following code snippet to the end of **wp-content/themes/streamtube-child/functions.php** or your own plugin and change the taxonomy name as desired.

{% embed url="https://gist.github.com/nttoanbrvt/ac730ae0861b293bb089541d5d4fa1b5" %}

***

For additional Custom Post Types and Custom Taxonomies capabilities, please refer to [content-capabilities](content-capabilities "mention")

***

#### Custom Taxonomy Capabilities <a href="#taxonomy-capabilities" id="taxonomy-capabilities"></a>

It follows the same structure and context as "[Custom Post Type Capabilities](#post-type-capabilities)."

{% embed url="https://gist.github.com/nttoanbrvt/622e54c016942207ffe2ff497fbd8288" %}

***

#### Custom Capabilities: Use Case & Caution <a href="#capabilities-caution" id="capabilities-caution"></a>

Modifying the capabilities of custom post types or taxonomies created by other plugins may lead to permission issues. Many plugin authors may not account for custom capabilities and instead rely on general capabilities for access control.

For example, some plugins might use:

```php
if( current_user_can( 'edit_categories' ) ){ 
    // Do something
}
```

Or

```php
if( current_user_can( 'edit_posts' ) ){ 
    // Do something
}
```

This approach is incorrect for checking permissions on custom taxonomies or post types, as each would have its own **capability\_type**, as explained earlier.

Instead, you should retrieve the post type or taxonomy object and check its specific capabilities accordingly.

{% embed url="https://gist.github.com/nttoanbrvt/ebabce2c6e1bbec63897de9dbb3dd6ea" %}

***

#### Field Group Location <a href="#field-group-location" id="field-group-location"></a>

The UI Location option allows you to set where the Field Group appears. Select "Both" to display it in both the backend and the frontend dashboard.

<figure><img src="https://2226487161-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqVWDZMetj6mBqmoSajgK%2Fuploads%2FLWJ6OMWcWpcSHVbBAWJY%2F8829566421.png?alt=media&#x26;token=a1adac97-0e32-425a-a22c-43bdf702817a" alt=""><figcaption><p>Field Group</p></figcaption></figure>

{% hint style="success" %}
&#x20;Looking for adding custom meta boxes programmatically? [add-custom-meta-boxes](for-developers/add-custom-meta-boxes "mention")
{% endhint %}

***

#### Custom User Fields <a href="#user-fields" id="user-fields"></a>

Any custom user fields created for the backend form will also be automatically applied to the frontend dashboard.

Please note that the **Dashboard > Account > General** Profile page will automatically display any custom fields you create for the User object. However, custom meta values will not be reflected on the public user profile page by default. To display them, you will need to use ACF functions or the **get\_user\_meta()** function programmatically.

* [https://www.advancedcustomfields.com/resources/](https://www.advancedcustomfields.com/resources/)
* [https://developer.wordpress.org/reference/functions/get\_user\_meta/](https://developer.wordpress.org/reference/functions/get_user_meta/)

![](https://2226487161-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqVWDZMetj6mBqmoSajgK%2Fuploads%2FOaU28SoRid8ygMEABc4h%2F8381150326.png?alt=media\&token=09f9bf60-d3b2-4296-b15d-b6c54134da37)

Sample code snippets

{% embed url="https://gist.github.com/nttoanbrvt/7b9de5d87dfe7ce80851dbca8f26da4b" %}
Display a specific ACF custom field on the user profile content area
{% endembed %}

{% embed url="https://gist.github.com/nttoanbrvt/b140a500dfef378de65d58679d85d3a9" %}
Display all Advanced Custom Fields (ACF) on the user profile content area
{% endembed %}

