You’re nearly there…
The ‘query_posts’ function is only intended to return posts (and other post types) so this will not work for roles. The line $roles = ...
is likely the cause of your error
instead it should just be:
$roles = $wp_roles->get_names();
Related Posts:
- gravity forms : use previous dropdown choice as variable in gform_pre_render? [closed]
- Gravity form to submit to third party application
- Adding multiple user roles dynamically
- outlook calendar event from form post [closed]
- Update post using gravity forms 2019 solution
- Gravity forms – Can I have multiple custom spinners? [closed]
- gform_after_submission add list of form titles after the post content [closed]
- How to make entries of Gravity Forms available in the public front-end? [closed]
- Creating custom array keys on gravity forms entry
- Pre-populate Gravity Forms Field with Custom Post Type
- gravity forms file upload field
- Form Object Gravity Forms [closed]
- Restricting product quantity field to numbers only in Gravity Forms
- Why does using conditional logic in gravity forms break the form when placed using php
- Gravity Forms Webhooks [closed]
- Is there a way to display poll question results in Gravity forms before submitting the form?
- Populate email field is wp-signup.php
- Submit a Gravity Form as other user [closed]
- magnific popup + gravity form query string not passing
- How to get the total donations made by a user – Gravity Forms? [closed]
- Gravity form multi-select issue on ios [closed]
- Pass MD5 value to prepopulate field
- Gravity Forms Upload each entry to Unique Folders
- Passing data from after_submission action to the confirmation filter in gravity forms?
- Gravity Forms redirect based on conditions
- Multi-image upload doesn’t work [closed]
- Gravity forms and wp_update_post [closed]
- Value of Query string [closed]
- Which capabilities are available in Gravity Forms Salesforce plugin? [closed]
- Gravity Forms non-empty Total field values not submitted [closed]
- Pass created post id from gform_after_submission action to gform_confirmation filter?
- Gravity Forms: tracking form [closed]
- Gravity Forum Custom Field Check box attribution
- Gravity Forms custom Field entry
- How to add custom input via PHP into every Gravity Form? [closed]
- Getting values in gform_confirmation for Gravity Forms [closed]
- Is there a way to call on just the content of a Page without actually using that Page? [closed]
- Gravity Forms, how to link form to amember pro signup [closed]
- Gravity Forms data to SOAP Service says Could not connect to host
- gravity form merge multiple records with the same id
- gravityforms chart
- Gravity Form Repeater File/Media Upload Not Working
- Gravity Form – notification if some values not match
- Gravity Forms Multiple Dates Filled by 1st Date
- WordPress – Gravityforms https:// is not a valid url
- Add (populate) multiple dynamic fields trough a url query
- Am i doing something wrong by getting plugins from github repos?
- Update post’s custom fields after workflow step approved or rejected in gravity flow
- Problem with Gravity Forms – multistep form
- Fill drop-down box with other text field entries
- My Gravity forms creates a Woocommerce order but I want to exclude a certain form
- Gravity Forms and regex – Doesn’t seem to validate
- Foreach loop through Gravity Forms entries
- Gravity form Multiple receiver with different message
- Use gform_pre_render / Google distance Matrix to calculate distance on page 2 of form based on input on page1
- Gravity Forms – RMA Count
- Gravity Forms + Post Fields + Divi Load From Library
- Gravity Forms Create Variable For Users Without Pre-existing Entries
- Paypal not converting currency when using Gravity Forms on WordPress
- Gravity Forms field ID $entry not working
- Gravity Forms ExactTarget Add-on Plugin: Nothing happens after step 2 when creating a new feed [closed]
- Prevent threading in emails from gravity forms [closed]
- GravityForms inside Gantry4 won’t display [closed]
- Gravity Forms: Limit entries by number of times of a certain field value and date
- Restricting text field to numbers only in Gravity Forms [closed]
- How do I add custom fields to Gravity Forms? [closed]
- How to call post update addon after payment in payment gateway gravity form plugin?
- How to deactivate gravityforms WordPress plugin
- Issue with dynamically populating address fields with Gravity Forms
- gravity forms api get_entries filter with created by id
- Get user role by ID WordPress
- If the current user is an administrator or editor
- How to check if a user is in a specific role?
- allow editors to edit menus?
- Getting a List of Currently Available Roles on a WordPress Site?
- How to change a user’s role?
- Editor can create any new user except administrator
- Allow member to have access to custom post type only. Permission to only edit their own posts
- Is there way to rename user role name without plugin?
- How to create a clone role in wordpress
- Where are available Roles Defined in the wp_ database?
- Possible to hide Custom Post Type UI/Menu from specific User Roles?
- How can I allow the Editor Role to change Theme Settings?
- How do I show data from gravity forms in my template? [closed]
- How to allow an user role to create a new user under a role which lower than his level only?
- How to add a Capability to a User Role?
- Separate registration and login for different roles
- Select subscriber as author of post in admin panel?
- Why are my roles not visible in a Multi-site/Network?
- How can I get a list of users by their role?
- Site admin in a network install can’t edit users?
- Remove update nags for non-admins [duplicate]
- How to get role of user
- Give Editor Access To Sidebar
- Remove Ability for Other Users to View Administrator in User List?
- How to allow editor to edit privacy page / settings only?
- How do I make a draft post accessible to everyone?
- Reset default roles and capabilities
- How do I remove dashboard access from specific user roles?
- Find out if logged in user is not subscriber