ACF Options

96 views
Skip to first unread message

John Visser

unread,
Apr 1, 2021, 1:31:03 PM4/1/21
to mpls-stpau...@googlegroups.com
Hey, group.

I've enabled an Options page in Advanced Custom Fields so a client can add/remove/edit some stuff on their website in a single location.

It's visible and works just fine with admin access, but not with any other role. Am I missing something?

This is what I have in the functions.php file:

// add Site Settings page with ACF
if(function_exists('acf_add_options_page')) {
   acf_add_options_page(
      array(
         'page_title' => 'Site Settings',
         'menu_title' => 'Site Settings',
         'menu_slug'  => 'site-settings',
         'capability' => 'manage_options'
      )
   );
}


~john

Nick Ciske

unread,
Apr 1, 2021, 2:17:15 PM4/1/21
to mpls-stpau...@googlegroups.com
Changing ACF options requires the “manage_options” capability by default, which only Administrator role users have by default.

You could grant that capability to other roles (using a role manager plugin like Members) but that gives them access to all WP options.

You can also adjust the capability required to see that page/manage options by passing it to the acf_add_options_page call (which you’re doing, but you’re passing the default capability of manage_options).

Change it to edit_posts or another capability shared by the users you want to see this, or use a custom capability and grant that to the roles that should have access. Just be careful you don’t open it up too wide (e.g. read would be a bad idea).

 'capability' => 'manage_options'

to

 'capability' => ‘edit_posts'

_________________________
Nick Ciske
CTO/CISO | LuminFire

Nick Ciske

unread,
Apr 1, 2021, 2:19:32 PM4/1/21
to mpls-stpau...@googlegroups.com
My bad! It defaults to edit_posts but you overrode it to manage_options, hence your issue.

_________________________
Nick Ciske
CTO/CISO | LuminFire

John Visser

unread,
Apr 1, 2021, 2:24:28 PM4/1/21
to mpls-stpau...@googlegroups.com
Ah! Duh. :)

Thank you!

~john


--
You received this message because you are subscribed to the Google Groups "Minneapolis St. Paul WordPress User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mpls-stpaul-word...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mpls-stpaul-wordpress/b2d1408b-30dc-4dc4-9787-528ec8cdab43%40Spark.
Reply all
Reply to author
Forward
0 new messages