WPThumbs
Themes Plugins By purpose By industry Best-of lists Fix it guides
Free Plugin by Scott Reilly v4.1

Get Custom Field Values

Use widgets, shortcodes, and/or template tags to easily retrieve and display custom field values for posts or pages.

Get Custom Field Values

The facts

Rating
5★ from 4
Active installs
1k+
Price
Free
Last updated
10 Oct 2023
Added
Dec 2004
Requires WP
3.6
Tested up to
WP 6.3.10
Downloads
133,047

Our analysis

AI-assisted

Get Custom Field Values is a WordPress plugin that enables you to retrieve and display custom field values for posts or pages. It offers a widget, shortcode, and template tags to facilitate this process, allowing for flexible integration into your site.

You can use the plugin to find custom fields for the current post, a specified post, a recent post, or randomly. It also allows for custom text or HTML to be added around the displayed values, enhancing the presentation of your content.

Best for: This plugin is suitable for WordPress users who need to manage and display custom field data effectively.

What it does well

  • Provides a widget and shortcode builder tool
  • Includes six template tags for custom field retrieval
  • Allows filtering of custom field values
  • Enables display of custom fields for various post types

Where it falls short

  • Limited information on specific use cases or examples
  • No details on user support or community engagement

Verdict

Get Custom Field Values offers a straightforward solution for handling custom fields in WordPress, though more detailed usage examples would be beneficial.

From the developer

Scott Reilly's own description of Get Custom Field Values, lightly tidied.

This plugin provides a powerful widget, shortcode (with shortcode builder tool), and template tags for easily retrieving and displaying custom field values for posts or pages.

The power of custom fields gives this plugin the potential to be dozens of plugins all rolled into one.

This plugin allows you to harness the power of custom fields/meta data. Use the “Get Custom Field” widget, the [custom_field] shortcode (which has a post editor sidebar widget to help you build the shortcode), or one of six template tags to retrieve and display custom fields. Find a custom field for the current post, a specified post, a recent post, or randomly. And for the custom field values found by the plugin, you may optionally specify text or HTML to appear before and after the results. If nothing is found, then nothing is display (unless you define text to appear when no results are found). If multiple results are found, only the first will be displayed unless you specify a string to be used to join the results together (such as “,”), in which case all will be returned. Visit the Examples section to see how this plugin can be cast in dozens of different ways.

There are six template tags provided by this plugin. Here they are, with an explanation of when they are appropriate for use:

  • c2c_get_custom() : Use this inside “the loop” to retrieve a custom field value for a post
  • c2c_get_current_custom() : This is only available on the permalink post template (single.php) and page template (page.php). Can be used inside or outside “the loop”. Useful for using custom field to define text you want to include on a post or page’s header, footer, or sidebar.
  • c2c_get_post_custom() : Useful when you know the ID of the post whose custom field value you want.
  • c2c_get_random_custom() : Retrieve the value of a random instance of the specified custom field key, as long as the field is associated with a published posted, non-passworded post (you can modify a setting in the plugin file to search passworded posts as well).
  • c2c_get_random_post_custom() : Retrieves the value of random custom field(s) from a post when you know the ID of the post you’re interested in.
  • c2c_get_recent_custom() : Retrieves the most recent (according to the associated post’s publish date) value of the specified custom field.

You can filter the custom field values that the plugin would display. Add filters for ‘the_meta‘ to filter custom field data (see the end of the code file for commented out samples you may wish to include). You can also add per-meta filters by hooking ‘the_meta_$sanitized_field‘. $sanitized_field is a clean version of the value of $field where everything but alphanumeric and underscore characters have been removed. So to filter the value of the “Related Posts” custom field, you would need to add a filter for ‘the_meta_RelatedPosts‘.

Links: Plugin Homepage | Plugin Directory Page | GitHub | Author Homepage

Developer Documentation

Developer documentation can be found in DEVELOPER-DOCS.md. That documentation covers the numerous template tags, hooks, and shortcode provided by the plugin.

As an overview, these are the template tags provided the plugin:

  • c2c_get_custom() : Template tag for use inside “the loop” and applies to the currently listed post.
  • c2c_get_current_custom() : Template tag for use on permalink (aka single) page templates for posts and pages.
  • c2c_get_post_custom() : Template tag for use when you know the ID of the post you’re interested in.
  • c2c_get_random_custom() : Template tag for use to retrieve a random custom field value.
  • c2c_get_random_post_custom() : Template tag for use to retrieve random custom field value(s) from a post when you know the ID of the post you’re interested in.
  • c2c_get_recent_custom() : Template tag for use outside “the loop” and applies for custom fields regardless of post.

These are the hooks provided by the plugin:

  • c2c_get_custom_field_values_shortcode : Filter to customize the name of the plugin’s shortcode.
  • c2c_get_custom_field_values_post_types : Filter to customize the post types that should support the shortcode builder metabox.
  • get_custom_field_values/can_author_use_shortcodes : Filter to customize if post author can make use of the ‘custom_field’ shortcode.
  • get_custom_field_values/show_metabox : Filter to customize if the shortcode builder metabox is shown.

The shortcode provided is [custom-field], which has a number of attributes to customize its behavior and output.

Read the full description on the official page →

Tagged as

Alternatives

Other plugins for custom content structures.

Ad Inserter

Manage Google AdSense ads, banners, ad rotation, sticky widgets, AMP ads, ads.txt, tracking, header and footer...

Free 300k+ installs 4.9★ (2,428)
Advanced Custom Fields

ACF helps customize WordPress with powerful, professional and intuitive fields. Proudly powering over 2 millio...

Free 2M+ installs 4.5★ (1,438)
Simple Custom Post Order

Easily reorder posts, pages, custom post types, and taxonomies with intuitive drag-and-drop sorting in the Wor...

Free 300k+ installs 4.8★ (569)
WP Activity Log

The #1 user-rated activity log plugin for event logging, activity monitoring and change tracking.

Free 300k+ installs 4.7★ (488)
Custom Post Type UI

Admin UI for creating custom content types like post types and taxonomies

Free 1M+ installs 4.6★ (276)