Delete custom fields or custom fields in WordPress

When we make updates or customizations to our website we are always testing how to add certain features or functionalities, one of these cases may be when we add custom fields with a plugin such as .

Hosting Mautic QuickStart -50% with support in Spanish
24 hours and free training

Send up to 1,000,000 emails/year. Mautic support in Spanish 24 hours, 365 days

This plugin is currently one of the most used in WordPress for the creation of advanced custom fields that allow us to create these functionalities and features that we sometimes want to incorporate into our website; however, one of the problems that you can see from this is when we are creating these custom fields and creating tests a lot of unused fields are created on our website.

In this way, if we delete a custom field, they remain in our database, which causes us to have unused and non-useful information in our database. In this article, we will see a little about what custom fields are and how we can delete fields. custom in WordPress.

What are custom fields or custom post type in WordPress?

Custom fields or Custom Post Type is additional content that we can add to our website and which allows us to enrich its content, these types of fields allow us to convert our normal WordPress website into a much more dynamic management system allowing us to display content customized from entries or post.

In an overview, the fields that WordPress incorporates by default are those elements that we already have on our website, an example of which we have in the entries that we create where by default we see that they contain titles, categories, labels, date, etc.

If you want to know how you can a little more about custom fields and how to create them, I invite you to review the article that we have available about them.

Why would we need to add additional fields in WordPress?

There can be many scenarios where we see the need to incorporate custom fields on our website, one of them can be a recipe blog where we could add, for example, preparation time, ingredients, portions, cooking time, etc.

As you can see, there can be various scenarios where we want to incorporate additional custom fields that allow us to extend the functionality of our content and display them in a dynamic and efficient way.

See also  Hosting WordPress Colombia | Free Domain Registration .com.co

Why do we need to delete custom fields in WordPress?

When we customize our website, some plugins or plugins that we use can generate custom fields by default, for example themes such as or Generatepress, since these offer within their functionality options to customize the publications individually.

In the same way when we create a custom field with ACF this information is generated in our database that is stored, the main problem with this is that when we change a theme or stop using some of these fields they become obsolete because we do not use them but they continue to remain in .

Since WordPress stores all these fields in the table wp_postmeta where other data such as comments are stored, a much larger table than a default installation is created, which can cause the database query of our website to slow down due to its size and we could see the speed of burden.

How can we see the custom fields we have creating on our website?

Whether we have created the custom field with the ACF plugin or it has been created by a theme or plugin that we have tested and are not using, we need to know which fields have been created, in order to see which fields we have added to our site. web the first thing we have to do is edit some of our entries from the section of Tickets All Ticketsonce we are at the entrance we can activate the display of custom fields.

Show custom fields in WordPress classic editor

If we are using the classic WordPress editor to display them we have to click on the screen option located in the upper right part of our browser, within this section we only have to activate the checkbox “Custom Fields” and they will be displayed at the bottom of our entry.

Show custom fields in WordPress Gutenberg editor

To show the custom fields in the new default editor, the first thing we have to do once we are in our post is go to the top menu of the post, which is shown with the three vertical dots that are in the upper right corner. Within this, click on the option “Preference” and then in the tab “Panels” once in this section we scroll down to the Additional section.

See also  Price visibility by customer group

In this section we only have to check if the option of “Custom Fields” is enabled, if not, enable it by clicking on the button “Activate and recharge”

Once we have managed to show the custom fields that we use on our website we will see the section with all the custom fields that we now have on our website, within this we only need to see which is the field that we have previously created or if one has a name plugin or theme that we have previously tested to remove it. For example in my capture I have a field ao_post_optimize that I don’t use

Delete custom fields or custom fields in WordPress

Once we have identified which are these custom fields that we do not use, we can delete them from our website. To delete the custom fields in WordPress correctly, the first thing is to search for them in our database to proceed to delete them.

Once we make the backup, the first thing we have to do is enter our WePane account / and access phpMyAdmin which is in the Databases section.

Within phpMyAdmin you must select the database of your WordPress installation.

Once we are in phpMyAdminwe have to make sure we select the correct database and click on the table “wp_postmeta” located in the left sidebar. Please note that the “wp_” is the default table prefix used in WordPress; however, you may have a different prefix for the tables in your database.

Within this table below the “meta_key” We will see all the names of the custom fields that we have added to our website, within this we could simply press Delete to delete the field we want.

If we want to delete several fields we just need to select several at the same time and delete them.

And what happens if we cannot locate our field quickly?

It may happen that although we can eliminate the custom fields in bulk, it is not easy to locate the meta_hey for all the publications we have, since each of them will have a set of custom fields, to locate them easily, a quick option is to access the search option found in the upper navigation bar, within this we select the button “Table Search” and we pay value of our custom field in meta_key field “value”.

See also  Wordpress WPO optimization issues with Nitropack/Var...

Make sure to select the operator LIKE “=” and click on the button “go”

This will show us all the occurrences of the value we are looking for in our database, if we want to delete all we just have to click on the option that indicates “check all” and then in the option “Delete”.

This way you can remove these custom fields that you don’t want to remain on your website.

Alternative to locate custom fields in your database.

A quicker option to locate the custom fields you want to remove is to access the tab “SQL” found in the top navigation bar and paste the following query.

SELECT * FROM `wp_postmeta` WHERE `meta_key` = ‘custom_field_name’

Keep in mind replace the prefix “wp_ “ why you use your database

The result will be similar to the one we mentioned before, since it will show all the occurrences of the value that we are looking for in our database, so we only have to follow the previous procedure to eliminate all the custom fields that we want to delete.

If you want to know a little more about the structure of the WordPress database and what is stored within it, you can review the following article that we have available where it is explained how the .

Conclusions

As you can see, optimizing our database will always be one of the most important points that we have to take into account, since having a correct storage of the data that we have in it benefits us to have a website that is much faster and with a load efficient.

You may also like:

Help us improve our content by sharing your opinion

WordPress and Woocommerce support team at .

Loading Facebook Comments ...
Loading Disqus Comments ...