Support

Account

Home Forums ACF PRO What user checks does Taxonomy have ?

Solved

What user checks does Taxonomy have ?

  • I ran into a similar problem I mentioned here.

    If I add a taxonomy field, users who do not have the manage_options capability will not see any values for loading the field. Instead it shows as loading failed, see image.

    loading failed

    So I was wondering what the taxonomy field checks on ? Because the problem disappear when I add manage_options to the role.

    The same happens for my own custom ACF plugin which I’m writing (not finished yet).

    Further investigation learned my custom site plugin was causing the problem. More specifically one redirect function, namely this one:

    
    function redirect_user_to( $redirect_to ) {
        global $current_user;
        wp_get_current_user();
        if ( ! current_user_can( 'manage_options' ) ) {
            $redirect_to = wp_redirect( home_url() . '/profile/' );
            exit;
        }
    }
    add_action( 'admin_init', 'redirect_user_to', 1 );
    

    How does this interfere with ACF’s taxonomy/dropdown fields ?

    I have yet to check if my other problem is also solved by this, but I think it might. Need some testing to be sure.

  • ACF does not do any checking during the query to get terms, as far as I can find. It does check the ‘manage_terms’ capability if the field allows adding terms. It could be that this capability is somehow causing the issue. The first answer here explains the ‘manage_terms’ capability pretty well http://wordpress.stackexchange.com/questions/45644/taxonomies-restrict-editing-and-creation-of-terms

  • My thoughts exactly. I didn’t think it would check on something and certainly not manage_options.

    Adding items is not allowed, except by site admins so that won’t be related imho.

    Would you have an idea why the aforementioned function kills the dropdowns ??

  • I would start by looking for a PHP error, or maybe even a JS error during the AJAX request to get the terms. I just did a test of adding a taxonomy field and then logged in as a contributor. The taxonomy field works and a contributor does not have ‘manage_terms’, so this cannot be causing your issue.

  • The affected roles are copies from the subscriber role which will be extended with 1 or 2 custom capabilities.

  • Since subscribers cannot generally edit anything but their own profile, you’ll need to figure out what permissions you need to give them for your custom post types. That’s going to be something in the say you’re setting up the post types and taxonomies and not anything to do with ACF.

  • All my (submitted) posts are submitted through a page, which holds the ACF form, which is ‘manipulated’ with an ID to create a new post or update an existing one.

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

You must be logged in to reply to this topic.