The next version of Index is here! To celebrate, take 25% off your purchase with the code 25OFF. Learn more
Index Logo

Single items

Register fields that only display when a single item is being edited. Each field returns its type and its current value. Fields are registered in PHP and sanitization is handled by Index.

Registering a single item edit field

Each edit field is tied to a specific post type:

// replace {$type} with the post type name
add_filter("index_single_{$type}_edit_fields", function($fields, $post_id) {
	return $fields;
});

See the Creating fields [LINK] document for more information on how to format fields.


Example

add_filter("index_single_post_edit_fields", function($fields, $post_id) {
	$fields[] = [
		'id' => 'custom_field_id',
		'label' => 'Custom field name',
		'type' => 'meta',
		'component' => 'text',
		'value' => get_post_meta($post_id, 'custom_field_id', true),
		'render' => get_post_meta($post_id, 'custom_field_id', true), 
	];

	return $fields;
});

Resources

  • Creating fields
  • Saving field data
  • Sorting fields

Get started with Index

See for yourself why Index is the most intuitive, beautiful interface for managing your WordPress content.