Skip to content

Image Field Prefill

Voxel's text, number, and date fields all have a Prefill value option — the image field doesn't. This function adds it: prefill image fields on new-post forms with a fixed image, or dynamically per user with tags like the author's avatar.

Overview

Enabling this function adds a Prefill value (VT) control to every Image field in Voxel's post type editor — the same dynamic-tag editor other fields use, with the author / site / page tag groups. It also makes Voxel's existing Default image picker work as a fallback (Voxel ships that setting but never applied it to forms).

Key Features

  • The same dynamic-tag Prefill experience as Voxel's other fields
  • Accepts attachment IDs (comma-separated for multi-image fields), attachment URLs, or dynamic tags
  • @author(avatar) prefills each submitter's own avatar — resolved per user at form load
  • Voxel's "Default image" setting acts as the fallback when the tag resolves empty
  • Applies to new posts only — editing an existing post never overwrites its images
  • Submitters can remove or replace the prefilled image before submitting
  • Respects the field's max count and allowed file types

Setup Instructions

  1. Navigate to Voxel Toolkit → Functions and enable Image Field Prefill
  2. Go to Voxel → Post Types and open the post type's Fields tab
  3. Open any Image field's options
  4. Fill in Prefill value (VT) — an attachment ID, URL, or dynamic tag
  5. Optionally set a Default image as the fallback
  6. Save the post type

Prefill Examples

ValueResult
123Attachment #123 prefilled for everyone
123,124,125Multiple images (multi-image fields)
@author(avatar)Each submitter's own avatar
https://yoursite.com/wp-content/uploads/logo.pngThe attachment behind that URL

Use Cases

Placeholder Branding

New listings start with your site's placeholder image instead of an empty gallery.

Personal Defaults

Profile-linked post types prefill the author's avatar as their logo.

Faster Submissions

Fewer required uploads means fewer abandoned forms — users only replace the image if they want to.

Troubleshooting

The Prefill control doesn't appear

  • Verify the function is enabled, then reload the post type editor

The form doesn't prefill

  • Prefill applies to new posts only — editing an existing post shows its own images
  • Confirm the tag resolves to a real attachment ID (test the ID directly first)
  • The attachment's file type must be allowed by the field (JPEG, PNG, WebP)

A user's avatar doesn't prefill

  • That user has no avatar set — the field falls back to the Default image, or stays empty

Built by Code Wattz.