How to feature an entry using PHP

If you want to modify whether an entry is featured using PHP instead of by starring an entry in WordPress Dashboard, you can do so by using the gravityview_featured_entries_enable filter.

Please note that entries featured using this method won't be able to move to the top even if the View is set to Move Featured Entries to top.

The parameters passed to gravityview_featured_entries_enable

  • $enable_featured_entry (boolean) Whether to enable featured entries for this entry
  • $view (GravityView_View) The current GravityView_View instance
  • $entry (array) Gravity Forms entry array

By returning false, the $entry will not be featured. By returning true, the entry will be featured.

Some sample code:

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us