Custom Field Toggle

Custom Field Toggle is a WordPress plugin developed to make the task of managing a particular custom field easy from the admin interface. If you need an easy way to change a normal post into a featured post, simply add a toggle.

Currently, the field value will default to 0 for “off” and 1 for “on.”


To This:

To setup, first go to the Toggle’s admin panel.

Click “Add Toggle” to get started.

The “Title” and “Field” areas must be filled out. The “Field” is the same custom field you would use in the following code where “_featured” is the custom field key.

function is_featured() {
 global $post;
 if ( isset($post) && is_numeric($post->ID) ) {
 return get_post_meta( get_the_ID(), "_featured", true);

The “Post Type” defaults to post, but you can substitute this with any valid post type used by your theme. For instance, wooCommerce uses “product” as the post type for it’s product pages and Event Manager uses “event” as its post type. The toggle will then appear on the corresponding add or edit interface for those post types.

Let me know if you have any issues on github.

Download the latest.

Leave a Reply