• Resolved saxpaolo

    (@saxpaolo)


    Hello – I’m testing out this nice extension plugin for my ACF Pro. I’m having problems on using the Code editor field by an WooCommerce Shop Manager user profile.
    I’ve implemented this field to let the Shop Manager to include an iframe for embedding content in a product page. When saving the product, the iframe disappear, evidently because it is “sanitized” before it is saved in the db, leaving only its container div.
    I’d like to know if it’s a problem related to this ACF Extended field in relation of a particular user profile, or it’s related exclusively to the WooCommerce/WordPress profile.

    Long story short: does ACF Extended fields have limitations in terms of user capabilities?
    Thanks in advance

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter saxpaolo

    (@saxpaolo)

    …just realised that the problem was caused by the “shop_manager” role capabilities, that doesn’t allow the user to include iframes.

    This could be overcome using an snippet like the one below:

    add_action('admin_init', function () {
                // gets the author role
                $role = get_role('shop_manager');
    
                // would allow the shop_manager to edit others' posts for current theme only
                $role->add_cap('unfiltered_html');
            });

    Be careful on assigning the unfiltered_html cap though…

    • This reply was modified 2 years, 9 months ago by saxpaolo.
    • This reply was modified 2 years, 9 months ago by saxpaolo.
    Plugin Author Konrad Chmielewski

    (@hwk-fr)

    Hello,

    I’m glad to hear that you managed to make it work!

    In fact, ACF & WordPress filter out sensitive data and HTML tags for non-admin user roles. You can try to use the acf/allow_unfiltered_html filter, it should work. See the following topic about this issue.

    Have a nice day!

    Regards.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Code editor field and User capabilities (WooCommerce)’ is closed to new replies.