Integration with a Post’s Metadata

by | Sep 1, 2020 | Blog, BuddyForms, featured

When we are creating a form in BuddyForms, whose purpose is to create or edit entries of a Post Type, sometimes we run into the situation that the post has one or more metadata. This metadata could be related to some post functionality that we also want to integrate in our form.

In most cases, these functionalities are implemented through themes or plugins, which use metadata as persistent variables to stock information related to the process or processes involved.

It’s important to mention that not all the metadata can be successfully integrated in BuddyForms. Depending on how these are being stocked in the database, we will know whether or not we can integrate them into our form. In general, if a metadata is stored as a serialized text string, it cannot be embedded, since each metadata must be associated with an input in the BuddyForms form.

What is Metadata?

The metadata is information associated to a post, users, comments and terms, which are generally used to constitute core functionalities, themes or plugins related to that type of data. This information can usually be modifiable from the user interface in the WordPress Administrator, for example, when creating or editing the entry of a publication in the Administrator, this information is usually introduced as a set of options, also called meta- box, which can be viewed or changed at any time by the user.

Note: A post Metadata is stored as an entry in the wp_postmeta table in the WordPress database

Use cases

Below we will present a series of use cases, using popular plugins as a reference, where it might be useful to integrate metadata with a BuddyForms form.

Note: The following examples may vary depending on the time and version of the plugin or related theme, they’re also practical examples that may not be applicable in certain contexts. Relevant research and testing is recommended to determine whether a use case is applicable to you or not.


Let’s suppose we want to create a BuddyForms form as simple as possible, which is able to edit or create functional WooCommerce products from the Front, with a series of predefined configurations in each product, having only the fields: Title, Content, Featured Image and Price (see Image 1).

product builder
Image 1

The solution

It’s important to mention that besides BuddyForms, we need to have the BF WooCommerce Form Elements add-on installed to be able to carry out the example.

The first thing we’ll do is create a BuddyForms form with the required fields (see Image 1), including the WooCommerce fields (special field of BF WooCommerce Form Elements with the product options) and a price type field, which will be used to establish the product price. Finally we should have something similar to this:

Image 2

The second thing we’ll do is to configure the WooCommerce field, so all the available options are hidden, in this way our form will be shown as in Image 1. The advantage of adding a WooCommerce type field with all the hidden options is that it allows us to predefine the setting that each product will have once it has been sent, without the need to “overload” the form with all the WooCommerce options.

As we need users to be able to set each product price created, we must configure the price type field (Regular Price) so when the product is sent, the metadata associated with the Regular Price field of that particular product is overwritten.

Note: WooCommerce uses Product as Post Type, which in conjunction with several metadata and taxonomies, defines the information for each product created.

The way to configure the Regular Price field or any other field that pretends to overwrite a metadata is very simple, we just have to set the field’s slug with a value that matches the metadata keyword (meta_key) that we want to overwrite.

Note: A way to obtain the meta_key of a metadata is by searching in the wp_postmeta table, if we know a post’s ID, we can perform a simple query to filter only the records associated with that Post. Another option is to search the documentation for the theme or plugin associated with the Post Type, generally this information is found in the section for developers. As a last option we could carry out an exhaustive inspection in the code, almost always this turns out to be the infallible option, but also the most laborious one.

Once the appropriate slug has been established for our price type field and our WooCommerce field configured, we can create or edit products from our BuddyForms form, with the price and other options specified in there.

Note: When adding new fields to overwrite a Post metadata, we must choose a field type that is consistent with the original field type used in the metadata displayed on the administrator page destined to create or edit an entry for that Post.

Events Calendar

Let’s suppose we want to create a BuddyForms form that allows us to create and edit events from the Front. Our form must have the fields: Title, Content, Start Date, End Record, Event URL. See Image 3.

Image 3

The solution

As in the previous example, the first thing we must do is create a BuddyForms form, which contains the necessary fields shown in Image 3. After this we must identify and set the fields that will be used to be integrated into the metadata, in our case, they will be: Start Date, End Date and Event URL.

To configure these fields we must first identify the metadata that we want to integrate, besides that, we must determine if these are compatible with the integration. Then we must configure the slug of each field according to the meta_key of the corresponding metadata (see Image 4 and 5).

Image 4
Image 5

In the case of the Start Date and End Date fields, besides slug we must also configure the date format, so it matches the format used by the plugin when storing the information. The easiest way to identify the correct format is to inspect the wp_postmeta table for records that match the meta_key _EventEndDate or _EventStartDate. In this case, the date formats must be configured in the next way:

Image 6

Note: As we mentioned above, these results may vary with time and version of the plugin, so they should be taken only as illustrative examples.

Once we have established the appropriate slugs and we have configured the date format for the Start Date and End Date fields, we’ll be ready to start creating or editing entries, if we need to add more fields, just repeat the aforementioned procedure.


As we have already seen, sometimes it’s beneficial to integrate the metadata of a Post Type in our BuddyForms form, we also saw how important it’s to know how the metadata is being stored in the database, to determine whether or not it’s embeddable in a BuddyForms form.

It’s important to note that each integration must be preceded by a corresponding investigation, since not in all cases an integration is applicable, sometimes a custom implementation may be necessary to complement the integration.

ThemeKraft offers the opportunity to create content for us. Guest Post

0/5 (0 Reviews)


Submit a Comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

More from the Magazine

How to Customize Your WooCommerce Product Page in 2022

If you’re in the e-commerce business and using WooCommerce to build your store, a good product page is essential in getting your customers to talk about your brand. Furthermore, customizing your product page will have your revenue soaring! Why Exactly is a...

8 Reasons Why WordPress Platform Remains Important for Digital Marketing in 2022

The open-source content management system WordPress currently powers 43% of all websites on the internet. That makes WordPress platform by far the most popular CMS globally, so it’s pretty clearly doing something right. If you’re looking for ways to make your digital...

3 Easiest Ways to Make Your WooCommerce Site Mobile-Friendly

3 Easiest Ways to Make Your WooCommerce Site Mobile-Friendly     If you own a WooCommerce site in 2022 and that site is not mobile-friendly, it is bad news. This is a blatant truth.   The competition in the industry is too high in today’s date and when...

3 Tips for Working With Digital Photos

So you’ve taken a bunch of great digital photos during a vacation, event, or outing, but they don’t look as good on the screen as they looked in your head. How do Instagrammers make their photos look great? Are they just stellar photographers? Not...

E-commerce Website Design: Top 10 Ecommerce Design Trends You Need To Know In 2022

Shopping has changed immensely because of the pandemic. People opt to shop online, and when your website is not ready for your customers, your business will fail.  Web design is your first line of offense; that’s why e-commerce stores these days need to focus on...

Top Pros And Cons of Native Vs Hybrid App Development in 2022

Native apps are apps intended to run on a specific OS, while Hybrid apps show elements of both a native app and a web app. The fundamental difference between these two apps is that the primary kind can be created across all stages, though the production of the native...

Benefits of Virtual Reality in WordPress Design and Development

Since the introduction of groundbreaking technologies such as Virtual Reality and AR, the world of web design has undergone a dramatic change. Major automotive brands, gaming brands, healthcare and education programmes have been the early adopters of these...

Why Digital Marketing Will Be An Important Asset For Any Startup Company In 2022

With new start-ups and brands launching each day, start-ups and new brands consequently have to compete with companies and their marketing campaigns that have been running for years. For start-ups to taste success, for instance, they have to market efficiently and...

10 Tips to Optimize Your WooCommerce Website

When we talk about e-commerce platforms, WooCommerce is considered a preferred choice for techies. It is very simple and easy to set up a WooCommerce site. You just need to simply purchase a domain, add the WooCommerce extension then utilize some tips to optimize your...

10 of the Most Important E-Commerce Trends You Need to Know in 2022: A Helpful Guide

The year 2021 brought many developments and challenges for retailers. The industry experienced advancements in technology, while simultaneously being hit with shipping and supply chain issues. The COVID-19 lockdowns forced retailers to become more innovative to reach...

15 Best Donation Plugins For Accepting Charity & Funds

Are you looking for suitable WordPress or WooCommerce-enabled donation plugins? Many plugins in the online marketplace enable you to accept online donations using your WordPress or WooCommerce-enabled site. Using donation plugins on your website is an effective and...

Top 5 Reasons to Choose Custom WordPress Development Over Theme

If you are considering having a website for your business, several questions might come to your mind. How do we develop it? Do we need to outsource website development services? How much does it cost? What platform to choose for the development? Though all of the...

Image SEO best practices for WordPress websites

Google search is one of the main traffic drivers for many websites. However, image search is gaining traction and is more relevant across different industries like photography, videography, e-commerce, entertainment, etc. In this article we’ll talk about Google image...

Is WordPress a good blogging platform?

WordPress has become one of the most important platforms for people all around the world. Being used by approximately one-third of the world’s population, it tops the most loved platforms for blogging with thousands of people adopting it as their first choice...

How is on-demand mobile app development changing the face of business?

Smartphones are the most potent and pervasive technological devices around us. Consumers connected businesses through their smartphones, where mobile apps allow them to get almost anything at the flick of a finger. Mobile apps, are also a way for businesses to connect...

The Ultimate Guide on Web Application Architecture

Learn the basics of web app architecture. In this post, you can find web application architecture types, components, and ways to create web app architecture.  Starting a new web project, you should pick the right architecture. It determines all the logic of app...

Digital Marketing: Use These Hacks to Boost Your Leads in 2021

Image (Source) Introduction  One thing the 2020 year has taught us is that it is never too late to grab new opportunities to sustain your business. COVID-19 pandemic has given an immense rise to online platform usage. It helps the businesses to continue their leads...

Deprecated Plugins on Themekraft

(Source) In a normal company’s lifespan, a lot of work is done, customers are acquired, and problems are surpassed. Also, many products are launched, and because of that many times, some of those products get left behind by time, technological advances, replaced...

Web Development Strategies for an Outstanding Site

Did you know that 59.5% of the entire world population uses the internet daily? Of this, about 92.6% use mobile devices to access the web. These people are using the internet to find products and services, connect with friends, work, and for entertainment. For any...

Lifetime Deals

Lifetime Deals or LTD is one of the most popular of many ways to sell your digital products in the SaaS industry. Subscriptions, standalone for free, and charge for some functionalities, Bundles, Addons, etc  While the subscriptions and the add ons have been around...

Best Google Analytics Plugins for WordPress in 2021

If you want to understand the behavior of your website or blog visitors and from where they are coming to your site. You need analytics plugins that will help you to easily track the behavior of your website visitors & traffic resources.  If you are a WordPress...

5 Hottest Trends of PHP Development in 2021

Quick Summary: With the latest updates in modern technology and trends, web development is also evolving and gaining continuous popularity over the past few years. Tech and non-tech businesses are searching for the new  PHP web development trends for developing a...

WordPress Security: How to Protect Your Website and Be Safe

Many site owners often complain that WordPress security sucks. Usually, this line of thinking stems from WP being an open-source platform thus being more vulnerable to external attacks. But, how true is that? Is WP secure? The truth is – YES. It is secure. It’s...

Guest Posts and Pay For Submission on Themekraft

(Source) We have always claimed that we have an educative role in the community and because of that, we’ll share our procedures to manage Guest Posts. Also, if you want to implement a Guest Post or even a Pay for Submission method, this article may help you a great...

Our Products

Share This