Support

Account

Home Forums ACF PRO Restrict editing on frontend

Solving

Restrict editing on frontend

  • Hello everyone, I have a question. I want to leave on my website frontend the acf_form option. Only for users who have registered on the site. I know the documentation example https://www.advancedcustomfields.com/resources/acf_form/. However, when I put the function appears perfectly. I want only registered users to see these editing options in the frontend. It is currently showing up for everyone. When I enable this option! Could someone indicate how to restrict? Thanks for any help.

  • Try wrapping your form in code like this:

    <?php if( current_user_can('edit_others_pages') ) {  ?> 
        // stuff here for user roles that can edit pages: editors and administrators
    <?php } ?>
  • or

    
    if (is_user_logged_in() {
      acf_form();
    }
    
  • I made it work! Only when I put on the head the restriction. However, I noticed that when saving, the page goes blank and does not load. I think it’s a matter of configuration. Another question is if it is possible for me to play the edit of the fields on a fakepage. Ex:

      site / cpt / post-name / edit will the fields appear without problems, being the same url linked?

  • I made it work! Only when I put on the head the restriction. However, I noticed that when saving, the page goes blank and does not load. I think it’s a matter of configuration. Another question is if it is possible for me to play the edit of the fields on a fakepage. Ex:

      site / cpt / post-name / edit will the fields appear without problems, being the same url linked?

Viewing 5 posts - 1 through 5 (of 5 total)

The topic ‘Restrict editing on frontend’ is closed to new replies.