Support

Account

Home Forums Front-end Issues Permission denied when upload new image on media gallery field

Solved

Permission denied when upload new image on media gallery field

  • Hello!

    I’ve created 2 new end-point where the user can insert new product (WooCommerce) and edit.

    For the new Post there is no problem, and when the user try to edit this product all work fine and other fields can be modified.

    When i upload new files, the media gallery upload appear, but i get a generic error: “You don’t have permission to upload file in this post” and the file cannot be uploaded.

    The AJAX action is upload-attachment.

    This user is a custom role, whit the capabilities ‘upload_files’.

    Thanks

  • Ok! I’ve resolved my self!

    WooCommerce have a function in it’s core, callled: woocommerce_register_post_type_product

    This function use the: register_post_type (default function in WP)
    And in WooCommerce there is 1 params called: capability_type

    This params change all default “post” or “posts” in WP, in new capabilities for WooCommerce.

    Examples:
    edit_post become edit_product
    edit_posts becomes edit_products

    Hope it help someone in the future to resolve conflicts about WP media gallery in front-end with WooCommerce products!

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

The topic ‘Permission denied when upload new image on media gallery field’ is closed to new replies.