Support

Account

Home Forums Backend Issues (wp-admin) Capability Needed to show ACF Reply To: Capability Needed to show ACF

  • I did, thanks to a fellow WordPress developer I know IRL.

    The problem in this clients case was that there was a piece of code in their theme that was adjusting the author using a line such as:

    $wp_query->set( 'author', $current_user->ID );

    in the child theme’s functions file. This was causing the ACF fields to disappear. I’m not 100% as to the reason, but it was definitely the cause. This code was used to remove the post the user didn’t own from view on the post listing screen.

    To solve the issue we just checked which page was being loaded before running the code using:

    if ( strpos( $_SERVER[ 'REQUEST_URI' ], '/wp-admin/edit.php' ) !== false ) {

    A little low tech, but it was the only way to go for this client due to other reasons not related to this. You could try hooking the code onto ‘load-edit.php’ instead, but that is untested so YMMV.

    My advice though is to deactivate all the plugins and jump back to the 2014 theme. I realize it’s a pain if your CPT is in your theme, but it is IMO the best way to find exactly where your problem lies.

    Oh and as for the original question about capabilities. As far as I can see there are no restrictions on capabilities for ACF, if you can edit (just single edit, not edit_others) the CPT then you should be able to access the ACF fields too.

    Hope that helps you out.