fauzanjeg

Fix Upload Avatar

Nov 28th, 2021
699
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /* Fix Upload Avatar */
  2. function fix_upload_avatar( $allcaps, $caps, $args, $class ) {
  3.     if ( strpos( $_SERVER['HTTP_REFERER'], 'edit-account' ) ) {
  4.         $allcaps['upload_files'] = true;
  5.     }
  6.     return $allcaps;
  7. }
  8. add_filter( 'user_has_cap', 'fix_upload_avatar', null, 4 );
RAW Paste Data