Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_filter( 'rwmb_meta_boxes', 'your_prefix_function_name' );
- function your_prefix_function_name( $meta_boxes ) {
- $prefix = '';
- $post_type = $_GET['post_type'];
- $taxonomy = '';
- $placehold = '';
- if ($post_type == 'education') {
- $taxonomy = 'education-category';
- $placehold = '教育推廣';
- }
- if ($post_type == 'marketing') {
- $taxonomy = 'marketing-category';
- $placehold = '行銷宣傳';
- }
- if ($post_type == 'other') {
- $taxonomy = 'other-category';
- $placehold = '其他';
- }
- $meta_boxes[] = [
- 'title' => __( 'education marketing and others field', 'your-text-domain' ),
- 'id' => 'education-marketing-and-others-field',
- 'post_types' => ['education', 'other', 'marketing'],
- 'style' => 'seamless',
- 'fields' => [
- [
- 'name' => __( '物件性質', 'your-text-domain' ),
- 'id' => $prefix . 'taxonomy_b375opj15eo',
- 'type' => 'taxonomy',
- 'field_type' => 'select',
- 'taxonomy' => [$taxonomy],
- 'placeholder' => $placehold
- ]
- ],
- ];
- return $meta_boxes;
- }
Add Comment
Please, Sign In to add comment