Plugin Directory

Test out the new Plugin Directory and let us know what you think.

Get Custom Field Values

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

3.7 (2016-01-31)

  • Change: Update widget framework to 011:
    • Change class name to c2c_GetCustomFieldValues_Widget_011 to be plugin-specific.
    • Set textdomain using a string instead of a variable.
    • Remove load_textdomain() and textdomain class variable.
    • Formatting improvements to inline docs.
  • Change: Add support for language packs:
    • Set textdomain using a string instead of a variable.
    • Don't load textdomain from file.
    • Remove .pot file and /lang subdirectory.
    • Remove 'Domain Path' from plugin header.
    • Add 'Text Domain' to plugin header.
  • Change: Reformat plugin settings code (spacing).
  • Change: Explicitly declare methods in unit tests as public.
  • Change: Minor improvements to inline docs and test docs.
  • New: Create empty index.php to prevent files from being listed if web server has enabled directory listings.
  • Change: Note compatibility through WP 4.4+.
  • Change: Update copyright date (2016).

3.6.1 (2015-08-21)

  • Change: Discontinue use of PHP4-style constructor invocation of WP_Widget to prevent PHP notices in PHP7.
  • Change: Use require_once() instead of include() for including include files.
  • Change: Use full path to include files.
  • Change: Update widget framework to version 010.
  • Change: Update widget to version 009.
  • Change: Update shortcode to version 003.
  • Change: Note compatibility through WP 4.3+.
  • New: Add unit tests for shortcode and widget class versions.
  • New: Add c2c_GetCustomWidget::version() to get version of the widget class.
  • New: Add c2c_GetCustomFieldValuesShortcode::version() to get version of the shortcode class.

3.6 (2015-03-04)

  • Update widget framework to 009
  • Update widget to 008
  • Explicitly declare widget class methods public
  • Add more unit tests
  • Reformat plugin header
  • Minor code reformatting (spacing, bracing)
  • Change documentation links to wp.org to be https
  • Minor documentation improvements and spacing changes throughout
  • Note compatibility through WP 4.1+
  • Drop compatibility with version of WP older than 3.6
  • Update copyright date (2015)
  • Add plugin icon
  • Regenerate .pot

3.5 (2014-01-17)

  • Includes a significant number of changes from the unreleased v3.4
  • Hide shortcode wizard by default (won't change existing setting for users)
  • Show shortcode wizard for new posts as well
  • Add unit tests
  • Cast all intended integer arguments as absint() instead of intval()
  • Update widget version to 006
  • Update widget framework to 008
  • Use explicit path for require_once()
  • Discontinue use of PHP4-style constructor
  • Minor documentation improvements
  • Minor code reformatting (spacing, bracing)
  • Note compatibility through WP 3.8+
  • Drop compatibility with version of WP older than 3.6
  • Update copyright date (2014)
  • Regenerate .pot
  • Change donate link
  • Update screenshots
  • Add banner

3.4 (unreleased)

  • Display shortcode wizard metabox for all post types
  • Add filter 'c2c_get_custom_field_values_post_types' to allow override of what post_types should get the shortcode wizard metabox
  • Add 'id' and 'class' as shortcode attributes to set same-named HTML attributes on 'span' tag
  • Wrap output in 'span' tag if either 'id' or 'class' shortcode attribute is defined
  • Shortcode wizard now omits 'between' and 'before_last' values if 'limit' was set to 1
  • Update widget version to 005
  • Update widget framework to 007
  • Return widget body content in widget_body() instead of echoing (to facilitate non-display of empty widgets)
  • Hook output of JS and creation of metaboxes to 'load-post.php', which eliminates use of pagenow
  • For class c2c_GetCustomFieldValuesShortcode, add register_post_page_hooks() and do_meta_box()
  • For class c2c_GetCustomFieldValuesShortcode, remove admin_menu()
  • Add checks to prevent execution of code if file is directly accessed
  • Re-license as GPLv2 or later (from X11)
  • Add 'License' and 'License URI' header tags to readme.txt and plugin file
  • Discontinue use of explicit pass-by-reference for objects
  • Remove ending PHP close tag
  • Note compatibility through WP 3.5+
  • Update copyright date (2013)
  • Move screenshots into repo's assets directory


  • Fix bugs in widget preventing proper display of custom field for current post (props Ross Higgins)
  • Trim and/or intval widget input fields in validate()
  • For shortcode widget's JS, output via 'admin_print_footer_scripts' instead of 'admin_footer'
  • Note compatibility through WP 3.3
  • Add 'Domain Path' directive to top of main plugin file
  • Add link to plugin directory page to readme.txt
  • Update copyright date (2012)


  • Fix fatal shortcode bug by updating widget framework to v005 to make a protected class variable public
  • Update widget version to 003


  • Modify c2c_get_random_custom() to support returning multiple random values (function now accepts additional arguments)
  • Rename widget class from 'GetCustomWidget' to 'c2c_GetCustomWidget'
  • Enable shortcode support for custom field values
  • Update widget framework to v004
  • Document shortcode
  • Note compatibility through WP 3.2+
  • Minor code formatting changes (spacing)
  • Minor readme.txt formatting changes
  • Add plugin homepage and author links in description in readme.txt
  • Add .pot
  • Update copyright date (2011)


  • Fix 'Send to Editor' for shortcode builder
  • (widget) Full re-implementation using C2C_Widget_002
  • (widget) Full localization support
  • (widget) Fix bug with saving widget
  • (shortcode) Output JS in footer instead of head
  • Add if(!function_exists()) checks around all functions
  • Change description
  • Add PHPDoc documentation
  • Remove docs from top of plugin file (all that and more are in readme.txt)
  • Add package info to top of file
  • Note compatibility with WP 3.0+
  • Drop compatibility with version of WP older than 2.8
  • Minor code reformatting (spacing)
  • Add Upgrade Notice section to readme.txt
  • Remove trailing whitespace
  • Update copyright date
  • Update screenshots


  • (Not publicly released.)


  • Added additional check to prevent error when running under WP older than 2.8


  • Added widget support (widgetized the plugin)
  • Added shortcode support ([custom_field])
  • Added c2c_get_post_custom() : Useful when you know the ID of the post whose custom field value you want.
  • Added 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
  • Added c2c_get_random_post_custom() : Retrieve the value of a random instance of the specified custom field key for a given post
  • Added c2c_get_recent_custom() : Retrieves the most recent (according to the associated post's publish date) value of the specified custom field.
  • Used $wpdb->prepare() to safeguard queries
  • Updated copyright
  • Noted compatibility through 2.8+
  • Dropped compatibility with versions of WP older than 2.6
  • Tweaked description and docs


  • Modified SQL query code for c2c_get_recent_custom() to explicitly look for post_type of 'post' and then optionally of 'page'
  • Per-custom field filter name is now made using a sanitized version of the field key
  • Minor code reformatting
  • Removed pre-WP2.0 compatibility and compatibility checks
  • Changed description
  • Updated copyright date and version to 2.5
  • Added readme.txt
  • Tested compatibility with WP 2.3.3 and 2.5


  • Removed the $filter argument from c2c_get_custom() and c2c_get_recent_custom()
  • Replaced $filter argument with more robust filtering approach: filter every custom field via the action 'the_meta', filter specific custom fields via 'the_meta_$field'
  • Add argument $include_static (defaulted to true) to c2c_get_recent_custom(); static posts (i.e. "pages") can be optionally excluded from consideration
  • Verified to work for WP 1.5 (and should still work for WP 1.2)


  • Minor bugfix


  • Minor bugfix


  • Added the new function c2c_get_recent_custom() that allows retrieving custom/meta data from outside "the loop"
  • Better filtering (on meta field itself instead of final output string)
  • Per-call filtering of meta fields
  • Prepended all functions with "c2c_" to avoid potential function name collision with other plugins or future core functions. NOTE: If you are upgrading from an earlier version of the plugin, you'll need to change your calls from get_custom() to c2c_get_custom()
  • Changes to make the plugin WordPress v1.3 ready (as-yet unverified)
  • Switched to MIT license


  • Added argument of $before_last (which, when $between is also defined, will be used to join the next-to-last and last items in a list)
  • Added invocation of an action called 'the_meta' so that you can do add_filter('the_meta', 'some_function') and get custom field values filtered as they are retrieved
  • To faciliate use of this plugin as the argument to another function, this plugin no longer echoes the value(s) it retrieves (user must prepend 'echo' to the call to get_custom())


  • Minor bugfix


  • Initial release

Requires: 3.6 or higher
Compatible up to: 4.5.5
Last Updated: 9 months ago
Active Installs: 9,000+


5 out of 5 stars


0 of 1 support threads in the last two months have been marked resolved.

Got something to say? Need help?


Not enough data

0 people say it works.
0 people say it's broken.

0,2,0 33,3,1