I need to add a custom field to the page of a recipe blog that as a specific post page for recipes. It has also a Custom Field sidebar backend menu where I can add a custom field with a custom name. Then I take this code name, and I've inserted like that

compiled the variables with that code, copied from another variable, that was yet in the theme:

 <?php while ( have_posts() ) : the_post(); 
  $recipe_sub_title = osetin_get_field('sub_title');
  $layout_type_for_recipe = osetin_get_settings_field('layout_type_for_single_recipe', 'half_left_image');
  $big_header_titled_image = false;
  $recipe_cooking_time = osetin_get_field('recipe_cooking_time');
  $recipe_serves = osetin_get_field('recipe_serves');
  $recipe_difficulty_string = osetin_get_difficulty_string(osetin_get_field('recipe_difficulty'));
  $cooking_temperature = osetin_get_field('recipe_cooking_temperature');
  $quick_description = osetin_get_field('quick_description');
  $details_position = osetin_get_settings_field('recipe_details_position', 'split');
  $considerations = osetin_get_field('considerations');..... etc>>

consideration is the custom field. And then call it in the page position with that code

          echo '<div>'.$considerations.'</div>';

I don't see it appear in the add recipe backend page, and nothing change also in the frontend page. I miss something? I need to call it also in another place? Thank you

1 Answer 1


You need to create metabox (contains custom fields with a form) for your post/page or custom post type. When you use your code block above, you only call for meta values of post. But if WordPress can't find any custom field or meta value, these variables retun null (and you can not see any value)

You can try Advanced Custom Fields or CMB2 plugins to create custom fields and metabox for your posts/pages/custom post types easily (Also these plugins are well documented for begginers).

After create your custom fields and meta box, you can call values from frontend.

You can ask me anything about these plugins.

  • I'VE yet installed in my theme the advanced custom field pro plugin. I've added there my custom field. But it seems not to save. Then I've noticed that, if I go in the acf-json theme folder, and add manually a custom field, all work fine. Now I don't understand why the backend gui don't create correctly the new custom field. But that is less important. My only doubt is, how to save this customization in the update process? I'm using child theme but how can I load that customization from the child theme folder? I've tried to copy the folder structure but it doesn't work.
    – BigBlack
    Aug 10, 2018 at 21:54
  • May ACF conflicts with another plugin or code (Jetpack etc.). In WordPress standart when you use child theme and if you create a new file (single.php, single-custom-post-type.php) and add WordPress loop in this file, WordPress automatically overrides parent theme file. Also if you use special code or file (etc. shortcodes.php) you need to define in your child theme's functions.php. also if you use parent themes function names, you need to remove file from parent theme's functions.php take look at further reading developer.wordpress.org/themes/advanced-topics/child-themes Aug 10, 2018 at 22:09
  • In my parent function for acf load and save, there's an if condition that look if it is a child theme, to find json starting from the stylesheet directory. So it must load it from child folder.. That's right? Or may be not enough? How can I test if it conflict with some plugin?
    – BigBlack
    Aug 10, 2018 at 22:21
  • Yea, if you have condition on your parent theme, json file need to load from child theme. ACF uses AJAX and javascript files for metabox creation or saving (with core WordPress save function). Inspect your post-edit or post-new pages and look for javascript errors. And also you can search with "acf conflicts" on WordPress Support area and acf support pages for known conflicts. Aug 10, 2018 at 22:55

Your Answer

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

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