---
title: "How to feature an entry using PHP"
date: 2026-04-23
author: "GravityKit"
link: "https://www.gravitykit.com/docs/gravityview-pro/featured-entries/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:

```

add_filter( 'gravityview_featured_entries_enable', 'modify_gravityview_featured_entries_enable', 10, 3 );

/**
 * Enable or disable featured entries for this entry
 *
 * @param boolean $is_featured Whether to enable featured entries for this entry
 * @param GravityView_View $view The current GravityView_View instance
 * @param array $entry Gravity Forms entry array
 *
 * @return boolean $is_featured Whether to enable featured entries for this entry
 */
function modify_gravityview_featured_entries_enable( $is_featured, $view, $entry ) {

	// If you want to feature a list of entry IDs, you can do so like this
	if ( in_array( $entry['id'], array( 12, 49, 388 ) ) ) {
		return true;
	}

	// Otherwise, return the default
	return $is_featured;
}
```

```

add_filter( 'gravityview_featured_entries_enable', 'modify_gravityview_featured_entries_enable', 10, 3 );

/**
 * Enable or disable featured entries for this entry
 *
 * @param boolean $is_featured Whether to enable featured entries for this entry
 * @param GravityView_View $view The current GravityView_View instance
 * @param array $entry Gravity Forms entry array
 *
 * @return boolean $is_featured Whether to enable featured entries for this entry
 */
function modify_gravityview_featured_entries_enable( $is_featured, $view, $entry ) {

	// If you want to feature a list of entry IDs, you can do so like this
	if ( in_array( $entry['id'], array( 12, 49, 388 ) ) ) {
		return true;
	}

	// Otherwise, return the default
	return $is_featured;
}
```

Read here how to add these code samples to your website: [Where to put code samples.](https://www.gravitykit.com/docs/gravityview/customizing-your-views/where-to-put-code-samples/)