Plugins: Custom fields

Plugins: Custom fields

We must save a structured data for a post and that data will be stored as custom fields. Plugin for that is.

To retrieve custom field data in theme:

$price = get_post_meta( get_the_ID(), 'product_price', true );

The only file I will edit is loop.php as this file is responsible for displaying a voucher.

Files for displaying voucher lists are search.php as search results and template-blog.php as the most common one.

New custom fields

I field name is beginning with underscore, it will be invisible to a user.


  • voucher_uid as unique ID.
    If detected and has some non-empty value, the voucher will be displayed by using custom fields, and not by manual entry.
  • voucher_name as main title
  • voucher_store as store name
  • voucher_info as information for customer
  • voucher_couponcode as coupon code
  • voucher_trackinglink as a link for affiliate tracking
  • voucher_trackpixel as a tracking pixel


I considered making a template support in posts, as in pages. For that I would use Single Post Template plugin. But, since we already heavily modified Sahifa theme, I decided to hardcode that.

Editing custom fields

In Wordpress language, it is called custom write panels or meta boxes. The plugins available were:

In a more manual way:

Chosen plugin: Advanced Custom Fields

For me, it was important to have custom fields separate - not as one huge custom value. In this way, it should be compatible with most of the plugins.

So I chose Advanced Custom Fields

Settings are really not working right now?


In theme /wp-content/themes/sahifa/, file functions.php put this line to hide admin page.

add_filter('acf/settings/show_admin', '__return_false');

Force English language in Admin area:

add_filter('acf/settings/current_language', 'current_language');
function my_acf_current_language() { return 'en'; }

ACF | How to Hide ACF Menu from Clients Hide menu item not working in ACF 5


Plugin for bulk editing of custom fields:

Miscellaneous resources

Custom Types, Metaboxes, etc.

Create Custom Single Post Templates for Specific Posts or Sections in WordPress WordPress › Types - Custom Fields and Custom Post Types Management « WordPress Plugins Custom Fields « WordPress Codex WordPress › Advanced Custom Fields « WordPress Plugins WordPress Custom Fields 101: Tips, Tricks, and Hacks

WordPress › Search for Magic Fields « WordPress Plugins WordPress › Search for custom « WordPress Plugins WordPress › Magic Fields 2 Toolkit « WordPress Plugins WordPress › Magic Fields 2 « WordPress Plugins WordPress › Simple Fields « WordPress Plugins best custom fields plugin wordpress - Google Search WordPress › Advanced Custom Fields « WordPress Plugins WordPress › Support » What plugin think is best for Custom Fields? WP-Types Vs AdvancedCF vs PODS Compare WP - Plugin Comparison - Content Type / Custom Fields - Google Sheets Best WordPress Plugins for Creating Custom Fields and Post Types - WP Mayor WordPress › Advanced Custom Fields « WordPress Plugins custom fields in pages wordpress - Google Search How to enable custom fields for pages (if not a bad practice)? - WordPress Development Stack Exchange

How to integrate custom database table in Wordpress and using Wordpress functions Post Types « WordPress Codex Must Use Plugins « WordPress Codex Custom Post Type Snippets to make you smile • Yoast plugin “custom post type” - Google Search WordPress › Types - Custom Fields and Custom Post Types Management « WordPress Plugins WordPress › Custom Post Type Maker « WordPress Plugins When Do You Need a Custom Post Type or Taxonomy in WordPress WordPress Custom Fields 101: Tips, Tricks, and Hacks WordPress › Custom Field Template « WordPress Plugins WordPress › More Fields « WordPress Plugins Extend WordPress With Custom Fields - Smashing Magazine Using WordPress Custom Fields, Part I: The Basics | Perishable Press WordPress Custom Fields, Part II: Tips and Tricks | Perishable Press WordPress › metaboxes « Tags « WordPress Plugins Edit Post ‹ — WordPress You searched for Outfittery Gutschein - Creating A Customizable Post List Template in WordPress With Advanced Custom Fields - WPMU DEV

A bug in settings of Advanced Custom Fields plugin

I want to hide admin page by adding filter for settings, but that way is not working. Also, forcing a language is also not working.

Please, do this and enable admin menu by editing file: /www/wp-content/themes/sahifa/custom-functions.php

Custom fields & Meta Fields

Complex Meta Fields

Custom Fields, Meta Boxes, Custom Post Types

ACF plugin je za: Custom Fields

jmslbam/advanced-custom-fields-wpcli -


But the best for me is: Carbon Fields. Woow! But also: CMB2 5+ Best Custom Fields Plugin for WordPress - PickPlugins Blog CMB2 is great, but it does not feel very “premium”

Great starter theme: Rodgath/n00b-Theme: Simple WordPress starter theme. with all this: Rodgath/Dilaz-Metabox-Plugin: WordPress metaboxes for themes and plugins.

GitHub - Rodgath/Dilaz-Metabox-Plugin: WordPress metaboxes for themes and plugins.

GitHub - alispx/quickfield Move away from CMB2 · Issue #44 · wpsight/wpcasa · GitHub

Custom Metaboxes - WP Georgetown Really really good review: Meta Box – A replacement for Advanced Custom Fields? ACF Custom Database Tables - hookturn Awesome ACF - Resources for Advanced Custom Fields

we think that it’s not a good idea to build your custom fields through the admin UI (as in ACF) — this way you disconnect the field definition from the version control, i.e. from the changes in the templates that actually render the custom field values.


Carbon Fields seems better, but ACF is “brute-force by popularity”, and is not so much worse.

Maybe I will use ACF for multiple reasons:

  • you can use it as Carbon Fields or any better plugin via ACF Theme Code Pro that will generate the code you put in PHP but even better, there is feature ACF Local JSON that’s perfect!
  • only one that supports writing into separate database tables: ACF Custom Database Tables
  • has the most support from other compatible plugins. Almost everything supports ACF - important ones: WP All Import,
  • great 3rd-party fields, for example ACF Focal Point
  • you can also include it in code, not like plugin. See Including ACF within a plugin or theme
  • in Pro version, Gutenberg Blocks are supported properly in a same manner as in Carbon Fields

Only if I need something commercial, I would use Carbon Fields. For my custom products, incorporate ACF in projects.

date 06. Dec 2015 | modified 28. May 2021
filename: Plugins » Custom Fields