phpface
  • Introduction
  • Installation
  • Verify License
  • Install Plugins
  • Import Sample Content
  • Content Capabilities
  • Theme Options
  • Site Logo
  • Elementor Widgets
  • Sidebars
  • Shortcodes
  • Widgets
  • Add Menu
  • Add Custom User Dashboard Pages
  • Mobile Bottom Menu
  • Upload/Embed Video
  • Upload Big Files
  • Transcode and Encrypt Video With FFmpeg
  • Video Collections
  • Video Chapters
  • Import YouTube Videos
  • Post Location
  • Live Chat and Private Messages
  • User Dashboard
  • Video Advertising
  • BuddyPress (Activity Stream, Notifications, User Groups, Friend Connections ... etc)
  • Restrict Content
  • User Registration / Membership
    • Patreon Membership
    • Paid Membership Pro
    • Paid Member Subscriptions
  • myCred
  • ACF - Advanced Custom Fields
  • Create User Channels
  • WP Statistics (Page Views, Reports, Analytics ...)
  • Sitekit By Google (Page Views, Reports, Analytics ...)
  • Limit Backend Access
  • Bunny Stream
  • Cloudflare Stream
  • DynTube Stream
  • WooCommerce - Sell Video Content
  • Dokan - WooCommerce Multivendor Marketplace.
  • Forums
  • Search Everything in WordPress
  • Translation
  • Changelogs
  • For Developers
    • Add Custom Meta Boxes
    • REST APIs & Upload
  • FAQs
    • How to resolve 404 Error?
    • How to update the theme and all bundled plugins?
    • How to update all bundled plugins?
    • What is a Short Video?
  • How to solve "video is being encoded, please wait a minute" issue?
  • How to Add Custom Roles and Capabilities?
  • How to set custom single video template?
  • End
    • Thank you!
  • Customer Support
Powered by GitBook
On this page

ACF - Advanced Custom Fields

PreviousmyCredNextCreate User Channels

Last updated 1 month ago

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.


Download:

The Advanced Custom Fields plugin is available for free at:

  • Official ACF Website

  • WordPress Plugin Repository


Documentation


Enable Frontend Post Type Editing:

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


Enable Non-ACF Post Type Editing

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

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.

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


Enable Frontend Taxonomy Editing:

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


Enable Non-ACF Taxonomy Editing

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.


For additional Custom Post Types and Custom Taxonomies capabilities, please refer to Content Capabilities


Custom Taxonomy Capabilities


Custom Capabilities: Use Case & Caution

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:

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

Or

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.


Field Group Location

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.

Looking for adding custom meta boxes programmatically? Add Custom Meta Boxes


Custom User Fields

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.

Sample code snippets

It follows the same structure and context as "."

https://www.advancedcustomfields.com/resources/
https://www.advancedcustomfields.com/resources/
https://developer.wordpress.org/reference/functions/get_user_meta/
https://www.advancedcustomfields.com/download/
https://wordpress.org/plugins/advanced-custom-fields/
Enable Frontend Post Type Editing
Enable Non-ACF Post Type Editing
Custom Post Type Capabilities
Enable Frontend Taxonomy Editing
Enable Non-ACF Taxonomy Editing
Custom Taxonomy Capabilities
Custom Capabilities: Use Case & Caution
Field Group Location
Custom User Fields
Custom Post Type Capabilities
Enable "Show UI Frontend" option.
Field Group
Display all Advanced Custom Fields (ACF) on the user profile content area
Display a specific ACF custom field on the user profile content area