Add Custom Meta Field Options Source for User Roles

This snippet registers a new options source named "User Roles" for JetEngine meta fields. When selected, it provides a predefined list of user roles as options for meta fields, allowing you to easily assign roles in your meta box fields.

Specifications
Add Custom Meta Field Options Source for User Roles
6 January, 2026
  • Plugin
    • JetEngine
  • Category
    • Dynamic Content
  • Programming languages
    • PHP
Source code

Installing Instruction

How to Add Snippets into the functions.php File of the Active Child Theme

Attention: Create a site backup before applying any changes to functions.php.

This ensures that you can restore the website if something goes wrong after adding the code snippet.

  1. Copy the required code snippet to your clipboard.
  2. Navigate to WordPress Dashboard > Appearance > Theme File Editor.
  3. Click the functions.php tab to open the file.
  4. Paste the code snippet below the existing code in the Selected file content: area.
  5. Click the "Update File" page.

Example Use Case

Use this snippet to add a custom meta field options source "User Roles" that provides a predefined list of user roles in JetEngine meta fields.
Applicable scenarios:

  • User role-based forms: Allow easy user role assignments in meta fields.
  • Membership sites: Assign capabilities or restrictions via meta fields.
  • Admin panels: Simplify role-related metadata entry.
Specifications
Add Custom Meta Field Options Source for User Roles
6 January, 2026
  • Plugin
    • JetEngine
  • Category
    • Dynamic Content
  • Programming languages
    • PHP
Source code

Let’s build together

Have your own solution?

Came up with a great solution and want to show it to the Crocoblock community?

Request a new feature

Leave a feature request through GitHub, and our developers will consider it