In this tutorial I will explain you how to show or hide a field depending on a value of another field within a simple WordPress metabox.
In this tutorial I will show you step by step how to add a custom field to a custom taxonomy in WordPress. Of course, this method is going to work great for default taxonomies as well.
Well, let’s take a look what we are going to create here.
And this is how it looks when you go edit a specific taxonomy term:
WordPress custom settings pages are quite useful when you are developing a plugin or a theme. You will definitely need some place in admin area where users can configure your plugin and Settings API is perfect for that.
And yes, we are going to use Settings API which will help us creating our options pages. It was added in WordPress 2.7 only. I really doubt that you are using a WordPress version prior 2.7, but anyway I think I have to mention that.
Below is the screenshot of a settings page we are going to create in this tutorial. I decided to make it simple, so we have multiple fields – a text field and a checkbox.
In this tutorial I am going to show you two options:
- First of all we are going to turn off WooCommerce Gutenberg blocks in settings (Block Manager).
- If it is not enough, then I will show how to completely disable specific WooCommerce blocks (or all of them).
As a result we will do something like this:
And we are going to do that without plugins!