Created
May 19, 2020 14:54
-
-
Save raftaar1191/a0a91844db2417fe623f5eb99d780793 to your computer and use it in GitHub Desktop.
ACF allow file upload from froutend
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function bb_theme_giveaway_edit_posts_callback( $capabilities ) { | |
| if ( is_page( 'giveaway' ) || ( ! empty( $_SERVER ) && ! empty( $_SERVER['HTTP_REFERER'] ) && strpos( $_SERVER['HTTP_REFERER'], '/giveaway/' ) !== false ) ) { | |
| $capabilities['upload_files'] = 1; | |
| $capabilities['edit_posts'] = 1; | |
| $capabilities['edit_post'] = 1; | |
| $capabilities['edit_published_posts'] = 1; | |
| } | |
| return $capabilities; | |
| } | |
| add_filter( 'user_has_cap', 'bb_theme_giveaway_edit_posts_callback' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment