Change WordPress user roles and capabilities Forums Bug Reports editors unable to edit media metadata

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #2868
    moranme
    Participant

    Editors can upload images under “Add New Media” but it won’t let them add/edit the fields: caption, alt, description. I created a new editor role and enabled all capabilities, but it didn’t fix the problem. As Admin, I am able to add/edit this data. Have you seen this before? I need the editors to be able to add captions to their photos.

    PS I’m also using ACF and Adminimize plugins.

    #2869
    Vladimir
    Keymaster

    Will editor can edit those fields if you deactivate User Role Editor?

    #2891
    moranme
    Participant

    Hi Vladimir,

    Yes, I narrowed down the problem further. It seems to be specific to the page restriction. All of my editors are restricted to be able to edit just one page. With this setting, they can edit their one page and upload new media (but unable to edit the metadata, which is my problem). When I turn this setting off (allowing them to edit any page), then the problem goes away and they can edit metadata.

    To restrict their editing to just one page, I go to each user profile, and in the Posts/Pages/Custom Post Types Editor Restrictions section, I click the radio button for “Allow” and then enter the page ID number in the field called “with post ID (comma separated).”

    #2892
    Vladimir
    Keymaster

    Hi,

    When you set edit restrictions for the role or user User Role Editor applies this restriction to all post types including the ‘attachment’ one. WordPress use this post type for the Media Library items.
    It’s possible to exclude some post types from this restriction scope with custom filter:

    ure_restrict_edit_post_type


    Try to exclude ‘attachment’ post type from edit restrictions using this filter.

    #2900
    moranme
    Participant

    Thanks. Does that code go in functions.php?

    And would it be this, exactly?

    add_filter('ure_restrict_edit_post_type', 'exclude_posts_from_edit_restrictions');
    function exclude_posts_from_edit_restrictions($post_type) {
      $restrict_it = true;
      if (current_user_can('editor')) {
          if ($post_type=='attachment') {
    	        $restrict_it = false;
          }
      }
      return $restrict_it;
    }
    #2901
    Vladimir
    Keymaster

    ‘Yes’ on both questions.

    #2902
    moranme
    Participant

    Never mind I got it to work! I put that code in functions.php and that fixed it. Thank you so much for the fast response!!

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.