Showing posts with label Sorry. Show all posts
Showing posts with label Sorry. Show all posts

Friday, December 29, 2017

wordpress - error "Sorry, you are not allowed to attach files to this post."

please edit the capabilities.php file at location /wp-includes/capabilities.php:

Replace below code:
function current_user_can( $capability ) {
    $current_user = wp_get_current_user();

    if ( empty( $current_user ) )
        return false;

    $args = array_slice( func_get_args(), 1 );
    $args = array_merge( array( $capability ), $args );

    return call_user_func_array( array( $current_user, 'has_cap' ), $args );
}
With
function current_user_can( $capability ) {
    $current_user = wp_get_current_user();

    if ( empty( $current_user ) )
        return false;

    if (is_admin())
        return true;
    $args = array_slice( func_get_args(), 1 );
    $args = array_merge( array( $capability ), $args );

    return call_user_func_array( array( $current_user, 'has_cap' ), $args );
}