Forum Replies Created
-
AuthorPosts
-
August 11, 2021 at 12:53 PM in reply to: WPML does not register custom fields for translation #30139
VoB
ParticipantHi! Is there any update on this issue? Thank you!
VoB
ParticipantHi Long! I wonder if you have any updates on this request. Thank you!
VoB
ParticipantGreat, thank a lot for your support! Is there any expected time to get this issue addressed?
VoB
ParticipantI saw those answers, but (1) they are old and (2) I use taxonomy advanced custom field for which Meta box has a special way of saving in DB. I was hoping to get some directions from Meta Box on this issue as it is claimed as 100% compatible with WPML.
Custom tables for custom fields is one of Meta Box feature and there is no warning about any incompatibility with WPML for this feature. Translating custom fields via WPML strings feature is very inconvenient.
Thanks!
VoB
Participant<?php add_filter( 'rwmb_meta_boxes', 'your_prefix_function_name' ); function your_prefix_function_name( $meta_boxes ) { $prefix = ''; $meta_boxes[] = [ 'title' => __( 'VoB Source for Article', 'your-text-domain' ), 'id' => 'vob-source-for-article', 'post_types' => ['vob-post-article'], 'storage_type' => 'custom_table', 'table' => 'wp_custom_vob_source_for_article', 'context' => 'side', 'priority' => 'high', 'fields' => [ [ 'name' => __( 'Source Name Tag', 'your-text-domain' ), 'id' => $prefix . 'vob_article_source_name_tag', 'type' => 'taxonomy_advanced', 'label_description' => __( 'Name of the publisher or web-site from taxonomy', 'your-text-domain' ), 'taxonomy' => ['vob_source_name_tag'], 'field_type' => 'select', 'placeholder' => __( 'Select source name from the list', 'your-text-domain' ), 'add_new' => true, ], [ 'name' => __( 'Source Name', 'your-text-domain' ), 'id' => $prefix . 'vob_article_source_name', 'type' => 'text', 'label_description' => __( 'Name of the publisher or web-site', 'your-text-domain' ), 'placeholder' => __( 'Or add name of the publisher or web-site here', 'your-text-domain' ), ], [ 'name' => __( 'Source URL', 'your-text-domain' ), 'id' => $prefix . 'vob_article_source_url', 'type' => 'url', 'label_description' => __( 'Link to content source', 'your-text-domain' ), 'placeholder' => __( 'Add source URL', 'your-text-domain' ), ], [ 'name' => __( 'Journalist / Author', 'your-text-domain' ), 'id' => $prefix . 'vob_article_source_author', 'type' => 'text', 'label_description' => __( 'Original article author name', 'your-text-domain' ), 'placeholder' => __( 'Add article author', 'your-text-domain' ), ], ], 'validation' => [ 'rules' => [ $prefix . 'vob_article_source_url' => [ 'required' => true, 'url' => true, ], ], ], ]; return $meta_boxes; }VoB
ParticipantThanks, Long!
Your suggestion helped to remove it from side admin menu, but not from the top one.
July 15, 2021 at 12:35 AM in reply to: Media custom fields data not persisted in custom tables #29517VoB
ParticipantThanks, Long! I have also come to that conclusion.
We would appreciate for a prompt fix. We have been evaluating ToolSet and Meta Box for our use cases and ability to add custom fields to Media Modal was one of the selling point as it saves our editors from additional clicks and is more straightforward.
VoB
ParticipantThanks, Long!
Is it possible to create a custom block an editor can add in such cases, but the data from that block should be saved in a custom field? I tried creating a block, but it seems only with static content and it does not allow any inputs.
VoB
ParticipantThanks for the support, Long! Does it mean that such fields cannot be controlled via Meta Box web UI then? I do not see where to add a call to get_current_user_id() to assign $user_id on the ui.
Thanks!
July 14, 2021 at 9:51 PM in reply to: Media custom fields data not persisted in custom tables #29507VoB
ParticipantHi Long,
I have used Meta Box web UI to create tables and it all looks correct in DB. Also, similar fields but added to a custom post type work as expected.
<?php add_filter( 'rwmb_meta_boxes', 'your_prefix_function_name' ); function your_prefix_function_name( $meta_boxes ) { $prefix = ''; $meta_boxes[] = [ 'title' => __( 'VoB Media Source', 'your-text-domain' ), 'id' => 'vob-source-media', 'post_types' => ['attachment'], 'media_modal' => true, 'storage_type' => 'custom_table', 'table' => 'wp_custom_vob_source_media', 'fields' => [ [ 'name' => __( 'VoB Source Name', 'your-text-domain' ), 'id' => $prefix . 'vob_source_name', 'type' => 'taxonomy_advanced', 'label_description' => __( 'Name of the publisher or web-site.', 'your-text-domain' ), 'taxonomy' => ['vob-source'], 'field_type' => 'select', 'add_new' => true, 'required' => true, ], [ 'name' => __( 'VoB Source URL', 'your-text-domain' ), 'id' => $prefix . 'vob_source_url', 'type' => 'url', 'label_description' => __( 'Link to content source.', 'your-text-domain' ), 'placeholder' => __( 'Add source URL', 'your-text-domain' ), 'required' => true, ], ], 'validation' => [ 'rules' => [ $prefix . 'vob_source_name' => [ 'required' => true, ], $prefix . 'vob_source_url' => [ 'required' => true, 'url' => true, ], ], ], ]; return $meta_boxes; }Your SQL query has been executed successfully. DESCRIBE <code>wp_custom_vob_source_media</code> ID bigint(20) unsigned NO PRI NULL vob_source_name text YES NULL vob_source_url text YES NULLJuly 14, 2021 at 12:54 PM in reply to: ✅How to reuse previously created custom field in multiple groups? #29490VoB
ParticipantThanks a lot, Long! I was able to achieve what I need.
July 14, 2021 at 12:53 PM in reply to: Media custom fields data not persisted in custom tables #29489VoB
ParticipantThis is generated PHP as an example. NOTE: I am not registering taxonomy in php, I am using Meta Box web interface for all fields.
<?php add_action( 'init', 'your_prefix_register_taxonomy' ); function your_prefix_register_taxonomy() { $labels = [ 'name' => esc_html__( 'Sources', 'your-textdomain' ), 'singular_name' => esc_html__( 'Source', 'your-textdomain' ), 'menu_name' => esc_html__( 'Sources', 'your-textdomain' ), 'search_items' => esc_html__( 'Search Sources', 'your-textdomain' ), 'popular_items' => esc_html__( 'Popular Sources', 'your-textdomain' ), 'all_items' => esc_html__( 'All Sources', 'your-textdomain' ), 'parent_item' => esc_html__( 'Parent Source', 'your-textdomain' ), 'parent_item_colon' => esc_html__( 'Parent Source', 'your-textdomain' ), 'edit_item' => esc_html__( 'Edit Source', 'your-textdomain' ), 'view_item' => esc_html__( 'View Source', 'your-textdomain' ), 'update_item' => esc_html__( 'Update Source', 'your-textdomain' ), 'add_new_item' => esc_html__( 'Add new source', 'your-textdomain' ), 'new_item_name' => esc_html__( 'New source name', 'your-textdomain' ), 'separate_items_with_commas' => esc_html__( 'Separate sources with commas', 'your-textdomain' ), 'add_or_remove_items' => esc_html__( 'Add or remove sources', 'your-textdomain' ), 'choose_from_most_used' => esc_html__( 'Choose most used sources', 'your-textdomain' ), 'not_found' => esc_html__( 'No sources found', 'your-textdomain' ), 'no_terms' => esc_html__( 'No Sources', 'your-textdomain' ), 'filter_by_item' => esc_html__( 'Filter by source', 'your-textdomain' ), 'items_list_navigation' => esc_html__( 'Sources list pagination', 'your-textdomain' ), 'items_list' => esc_html__( 'Sources list', 'your-textdomain' ), 'most_used' => esc_html__( 'Most Used', 'your-textdomain' ), 'back_to_items' => esc_html__( 'Back to sources', 'your-textdomain' ), ]; $args = [ 'label' => esc_html__( 'Sources', 'your-textdomain' ), 'labels' => $labels, 'description' => '', 'public' => true, 'publicly_queryable' => true, 'hierarchical' => false, 'show_ui' => true, 'show_in_menu' => true, 'show_in_nav_menus' => true, 'meta_box_cb' => true, 'show_in_rest' => true, 'show_tagcloud' => true, 'show_in_quick_edit' => true, 'show_admin_column' => false, 'query_var' => true, 'sort' => false, 'rest_base' => '', 'rewrite' => [ 'slug' => 'source', 'with_front' => false, 'hierarchical' => false, ], ]; register_taxonomy( 'vob-source', [], $args ); }July 14, 2021 at 12:50 PM in reply to: Media custom fields data not persisted in custom tables #29488VoB
ParticipantThis is generated PHP as an example. NOTE: I am not registering these fields in php, I am using Meta Box web interface for all fields.
<?php add_filter( 'rwmb_meta_boxes', 'your_prefix_function_name' ); function your_prefix_function_name( $meta_boxes ) { $prefix = ''; $meta_boxes[] = [ 'title' => __( 'VoB Media Source', 'your-text-domain' ), 'id' => 'vob-media-source', 'post_types' => ['attachment'], 'media_modal' => true, 'storage_type' => 'custom_table', 'table' => 'wp_custom_vob_media_source', 'fields' => [ [ 'name' => __( 'VoB Source Name', 'your-text-domain' ), 'id' => $prefix . 'vob_source_name', 'type' => 'taxonomy', 'label_description' => __( 'Name of the publisher or web-site.', 'your-text-domain' ), 'taxonomy' => ['vob-source'], 'field_type' => 'select', 'add_new' => true, 'required' => true, ], [ 'name' => __( 'VoB Source URL', 'your-text-domain' ), 'id' => $prefix . 'vob_source_url', 'type' => 'url', 'label_description' => __( 'Link to content source.', 'your-text-domain' ), 'placeholder' => __( 'Add source URL', 'your-text-domain' ), 'required' => true, ], ], 'validation' => [ 'rules' => [ $prefix . 'vob_source_name' => [ 'required' => true, ], $prefix . 'vob_source_url' => [ 'required' => true, 'url' => true, ], ], ], ]; return $meta_boxes; } -
AuthorPosts