Support Forum
Support › MB Custom Post Type › Avoiding Custom Field Duplication Across Multiple CPTs in BricksBuilderResolved
Hello Metabox Team,
I have created several fields using Metabox and assigned them to some custom post types (CPTs) as I intend to use them there. Now, I am attempting to create a template with BricksBuilder and select the field for my phone number, for instance. This is the display I receive:
Currently, I can select the same field for each individual CPT. However, I would prefer to have a global field so that I don't need to create a template for each CPT. Is this possible? If so, how can it be achieved?
Thank you for your assistance.
Best regards,
Tobias Haas
Hello Tobias,
If you want to have a global field, please consider using the settings page with custom fields like the theme options. Please follow the documentation
https://docs.metabox.io/extensions/mb-settings-page/
I probably expressed myself a little wrong. By global I meant that I can use it on every CPT and in the same template without having different fields.
Instead of this
{mb_restaurant_telefon_standort}{mb_einkaufen_telefon_standort}{mb_freizeit_telefon_standort}
i want just this.
{mb_telefon_standort}
Hello,
There isn't a global custom field. A field has to be associated with a post. You can create a specific field group with some fields and assign it to more CPTs. Then you will have the same field ID for all posts of those CPTs.
Can you be a bit more specific here, I still don't understand. Where exactly do I do that? Is there an article about it?
Here is an example https://imgur.com/2XScFBN
create a field group with some specific fields and assign the field group to more CPTs.
This is what im doing! 🙁
https://share.cleanshot.com/jzr1kxfS
https://share.cleanshot.com/v09Ln0lZ
If you check the field ID and value in the database, table wp_postmeta, you can see the meta key is the same for posts in other post types. I think Bricks builder automatically adds the CPT slug to their variable. You can ask Bricks support to get more information.