### [Setting the Default Camera Direction for the Camera Field](https://wpforms.com/developers/setting-the-default-camera-direction-for-the-camera-field/)

**Published:** February 24, 2026
**Author:** Umair Majeed

**Content:**

Would you like to set the default camera direction for the WPForms Camera field on mobile devices?

By default, mobile browsers decide which camera to open when using the Camera field. In some cases, you may want to force the front camera or rear camera as the default when the camera opens.

This can be done with a small snippet that sets the default facing mode before the WPForms Camera field initializes.

---

### Setting the Default Camera Direction

Now it’s time to add the snippet to your site.

If you need help adding custom code to your site, please see our [tutorial on adding code snippets](https://wpforms.com/developers/how-to-add-custom-php-or-javascript-for-wpforms/).

```

/**
 * Set the default camera direction for the WPForms Camera field.
 *
 * user        = front camera
 * environment = rear camera
 *
 * @link /https://wpforms.com/developers/setting-the-default-camera-direction-for-the-camera-field/
 */
add_action( 'wpforms_wp_footer', function() {
	if ( is_admin() ) {
		return;
	}
	?>

**Categories:** Tutorials, Fields

---

