I'm trying to include a few custom fields I've created in my functions.php file so they're native to the theme I'm working on. However they're not showing up on the edit screens of the posts I've set them to.

I've included the acf plugin in my theme by using this code in my functions.php: include_once('advanced-custom-fields/acf.php');

I also exported the fields to php and copy and pasted the code in the functions.php of my theme. Can anyone tell me what I'm doing wrong?


2 Answers 2


Check that ACF included in your theme, if not than include acf. Try to use following code:

if( !class_exists('Acf') )
    include_once get_stylesheet_directory_uri() . '/advanced-custom-fields/acf.php' );
  • @haque thanks, i did add the code like this define( 'ACF_LITE', true ); if( !class_exists('Acf') ) include_once (get_stylesheet_directory_uri() . '/plugins/advanced-custom-fields/acf.php' ); but still did not work am i doing anything wrong
    – 95media
    Jan 22, 2017 at 16:45

Have you added the custom field into a post?

In my experience, using the custom field in functions.php, plugins, templates, or whatever doesn't put the field as an option in any post. Adding the field manually into any post WILL make it available to any post after that.

And you don't need ACF (Advanced Custom Fields plugin) to use custom fields, unless you want all the fancy options they supply. All you have to do is create a custom field, then start accessing it via appropriate calls to postmeta.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.