Home Forums Add-ons Options Page get the value of an options field in a plugin


get the value of an options field in a plugin

  • I am using the Advanced Custom Fields plugin with the options add on. How can I use the value of a field from options in a plugin? I have a simple php file in the plugins folder that needs to get this value. Is that possible?

  • You can copy ACF into your plugin folder and include it (

    include_once('advanced-custom-fields/acf.php' );

    Might be a better way…

  • You can either use the normal ACF functions, you just need to make sure you access them after all the plugins are loaded or depending on the type of field your using you can use the standard WP get_options()

    Values set on options pages are stored in you options table. The formatting of the value will depend on the field type. If you have things like repeater fields then using get_option could be a bit complicated.

    I don’t include ACF premium plugin in my own plugin, instead I state that they are required. It saves me the hassle of needing to redistribute them or update my plugins when they’re updated. It’s a personal choice, but I include the fact that these are required in the plugin description and leave it up to the user to get the premium add-ons themselves. Most of my plugins are not available from the WP repository because of this, in fact, many of them are not publicly available at all.

Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘get the value of an options field in a plugin’ is closed to new replies.