Title: Protect ACF Fields WIthin Shortcode
Last modified: April 24, 2019

---

# Protect ACF Fields WIthin Shortcode

 *  Resolved [James](https://wordpress.org/support/users/jmdesignsolutions/)
 * (@jmdesignsolutions)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/protect-acf-fields-within-shortcode/)
 * Hi,
 * I have another question concerning this plugin, I have some custom fields in 
   a page template that I’d like to wrap in the plugin’s short code however I can’t
   seem to get them working. Is this possible with this plugin?
 * Thanks,
 * James

Viewing 6 replies - 1 through 6 (of 6 total)

 *  Thread Starter [James](https://wordpress.org/support/users/jmdesignsolutions/)
 * (@jmdesignsolutions)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/protect-acf-fields-within-shortcode/#post-11466331)
 * Just to follow this up, the issue I’m having is that I have a page template with
   content not in the default WordPress body that I’d like to protect but I can’t
   seem to get it working using the short codes as the content is using an ACF repeater
   field which is in PHP.
 *  Plugin Author [Daniel Iser](https://wordpress.org/support/users/danieliser/)
 * (@danieliser)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/protect-acf-fields-within-shortcode/#post-11479053)
 * [@jmdesignsolutions](https://wordpress.org/support/users/jmdesignsolutions/) –
   Wrap all your ACF code for output buffering then use do_shortcode and a concatenated
   string with the ob output.
 *     ```
       ob_start();
   
       // do acf rendering here
   
       $content = ob_get_clean();
       echo do_shortcode('[content_control]' . $content . '[/content_control]');
       ```
   
 * Hope that helps.
 *  Thread Starter [James](https://wordpress.org/support/users/jmdesignsolutions/)
 * (@jmdesignsolutions)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/protect-acf-fields-within-shortcode/#post-11481486)
 * Hi,
 * Thanks for the help, I’ve added your code in my page template file placing my
   ACF code where your comment is but nothing has changed, the content still shows?
 * Is there anything else I need to add?
 * Thanks,
 * James
 *  Thread Starter [James](https://wordpress.org/support/users/jmdesignsolutions/)
 * (@jmdesignsolutions)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/protect-acf-fields-within-shortcode/#post-11482134)
 * Ignore this, all sorted now.
 * Thanks for your help!
 * James
 *  Plugin Author [Daniel Iser](https://wordpress.org/support/users/danieliser/)
 * (@danieliser)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/protect-acf-fields-within-shortcode/#post-11483137)
 * [@jmdesignsolutions](https://wordpress.org/support/users/jmdesignsolutions/) –
   Awesome, yea this solution is solid ;). We use it regularly when capturing content
   is required.
 * Btw, If you have a moment, I would very much appreciate if you could quickly 
   [rate the plugin](https://wordpress.org/support/plugin/content-control/reviews/?rate=5#rate-response),
   just to help us spread the word.
 *  Thread Starter [James](https://wordpress.org/support/users/jmdesignsolutions/)
 * (@jmdesignsolutions)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/protect-acf-fields-within-shortcode/#post-11483144)
 * No problem, done 🙂

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Protect ACF Fields WIthin Shortcode’ is closed to new replies.

 * ![](https://ps.w.org/content-control/assets/icon-256x256.gif?rev=2968535)
 * [Content Control - The Ultimate Content Restriction Plugin! Restrict Content, Create Conditional Blocks & More](https://wordpress.org/plugins/content-control/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/content-control/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/content-control/)
 * [Active Topics](https://wordpress.org/support/plugin/content-control/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/content-control/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/content-control/reviews/)

 * 6 replies
 * 2 participants
 * Last reply from: [James](https://wordpress.org/support/users/jmdesignsolutions/)
 * Last activity: [7 years, 1 month ago](https://wordpress.org/support/topic/protect-acf-fields-within-shortcode/#post-11483144)
 * Status: resolved