Add Media Upload Button to bbPress
by Bandicoot Marketing on | Posted in Tutorials | 8 comments
As a moderator in bbPress, you sometimes need to upload an image in order to better explain a solution. In the past I uploaded the image using the Media uploader, copied the URL and then pasted it into the discussion. Not the most efficient way of doing things.
After a little bit of research, I discovered that I can easily add a media upload button to make the whole process a lot more streamlined.
Open up your functions.php
file and add the following snippet to get it working:
add_filter( 'bbp_after_get_the_content_parse_args', 'bavotasan_bbpress_upload_media' ); /** * Allow upload media in bbPress * * This function is attached to the 'bbp_after_get_the_content_parse_args' filter hook. */ function bavotasan_bbpress_upload_media( $args ) { $args['media_buttons'] = true; return $args; }
With this snippet in place, moderators will now have the ability to upload using the built-in media uploader. There may be a way to also allow regular users to have access to the button but I haven’t delved deeper into that since I didn’t require that option.
8 comments for “Add Media Upload Button to bbPress”