This is a guide on how to find meta keys on your database. This is useful when you want to create custom columns or need to know the meta key for other reasons.
Let’s suppose that you have a post type, for example, products; and you have a plugin that adds the field “downloadable” to determine whether that product is downloadable or not. This field is not showing on the spreadsheet even though you have followed the missing columns guide exactly as described. So we will look for the field key so you can add it as a custom column.
Step 1: Download the WP Sheet Editor for Troubleshooting Extension by clicking here
Step 2: Go to the list of posts, for example “All Products”.
Step 3: You are going to notice that under the title of the post there’s a new action called “WP Sheet Editor: Troubleshooting” or alternatively, you can go to the spreadsheet itself and look for the new column called “Print data”
Step 4: When you click on any of the previous buttons, you will be taken to a page where you can see all the fields related to the post, in this case, we are seeing all the fields related to the product “Shirt for Men”.
Step 5: You need to find the field you are looking for, for that, you can look for a name similar to the field. In our example, we are trying to find a field that tells us whether the product is downloadable or not, so we will press Crl + F (or Command F on Mac) and search for the word “download”. We will see that a field is highlighted. You can see what is the meta key field on the following screenshot.
The meta key is what you see between the quotation marks, in this case: _downloadable. You can now use this meta key to do several processes, but the most important regarding our plugin is adding new custom columns, you can find a guide on how to add new custom columns here
Pro Tip: When you can’t find the meta key you are looking for, it’s a good idea to open the print data screen > edit the field you want to find on the regular WordPress editor > duplicate the print data screen tab > use a site like www.text-compare.com to compare both texts and find the difference. Some meta keys don’t necessarily have a friendly name and finding differences in the metadata could be very useful
Note: If nothing changes after following the pro tip, that means that the meta field is not saved on that post table and is probably saved on a custom table, for which you are going to need custom development to see the field on the spreadsheet.
Note 2: You will probably notice you have 3 different meta key types on the print data screen: Post data, Post Meta, and Post Terms. In order for the custom columns to work, you need to identify which post source is the meta key coming from, for example, all the meta keys that you find under the section below are Post Data
Post data ========
And all the meta keys that you find under this section below, are Post Meta
Meta ========