Title: codesxt's Replies | WordPress.org

---

# codesxt

  [  ](https://wordpress.org/support/users/codesxt/)

 *   [Profile](https://wordpress.org/support/users/codesxt/)
 *   [Topics Started](https://wordpress.org/support/users/codesxt/topics/)
 *   [Replies Created](https://wordpress.org/support/users/codesxt/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/codesxt/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/codesxt/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/codesxt/engagements/)
 *   [Favorites](https://wordpress.org/support/users/codesxt/favorites/)

 Search replies:

## Forum Replies Created

Viewing 7 replies - 1 through 7 (of 7 total)

 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Meta Box] rwmb is not defined](https://wordpress.org/support/topic/rwmb-is-not-defined/)
 *  [codesxt](https://wordpress.org/support/users/codesxt/)
 * (@codesxt)
 * [6 years, 9 months ago](https://wordpress.org/support/topic/rwmb-is-not-defined/#post-11873477)
 * They were not! Making that change fixed the issue! Sorry for taking your time
   with this. In the end the problem was caused by the theme and not Meta Box nor
   my code.
    I’m really really thankful!
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Meta Box] rwmb is not defined](https://wordpress.org/support/topic/rwmb-is-not-defined/)
 *  [codesxt](https://wordpress.org/support/users/codesxt/)
 * (@codesxt)
 * [6 years, 9 months ago](https://wordpress.org/support/topic/rwmb-is-not-defined/#post-11873469)
 * Sadly I think my client wouldn’t allow it. I’m working for someone else. I’ll
   ask him tomorrow anyway.
 * Here I found some of the customizations that the theme has. Maybe this has to
   do with it since it’s not including rwmb.
 *     ```
       jQuery( function ( $ )
       {
       	'use strict';
   
       	$(document).ready(function(){
   
       		/*if ( $('#_tour_charge_child').length ) {
       			$('#_tour_charge_child').change(function(){
       				$('#_tour_price_child').closest('.rwmb-field').toggle(this.checked);
       			});
       			$('#_tour_charge_child').trigger('change');
       		}
       */
       		if ( $('input[name="_tour_repeated"]').length ) {
       			$('input[name="_tour_repeated"]').change(function(){ toggleDatePicker();});
       			toggleDatePicker();
       		}
   
       		function toggleDatePicker() {
       			var flag = true;
       			if ( $('input[name="_tour_repeated"]:checked').val() == 1 ) flag = false;
   
       			$('input[name="_tour_date"]').closest('.rwmb-field').toggle(flag);
       			$('input[name="_tour_start_date"]').closest('.rwmb-field').toggle(!flag);
       			$('input[name="_tour_end_date"]').closest('.rwmb-field').toggle(!flag);
       			$('select[name="_tour_available_days[]"]').closest('.rwmb-field').toggle(!flag);
       		}
   
       		if ( $('.ct_datepicker').length ) {
       			$('.ct_datepicker').datepicker({ dateFormat: "yy-mm-dd" });
       		}
   
       		if ( $('.has_multi_schedules').length ) {
       			$('.has_multi_schedules').change(function(){
       				var $wrapper = $(this).closest('.schedule-wrapper');
       				var $check_box = this;
       				$wrapper.find('.add-clone, .remove-clone, .schedule-header').toggle(this.checked); // hide add-clone, remove-clone, date fields
       				$wrapper.find('.rwmb-clone').each(function(index){
       					if ( index != 0 ) $(this).toggle($check_box.checked);
       				}); // hide the other schedules
       			});
       			$('.has_multi_schedules').trigger('change');
       		}
       	});
       } );
       ```
   
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Meta Box] rwmb is not defined](https://wordpress.org/support/topic/rwmb-is-not-defined/)
 *  [codesxt](https://wordpress.org/support/users/codesxt/)
 * (@codesxt)
 * [6 years, 9 months ago](https://wordpress.org/support/topic/rwmb-is-not-defined/#post-11873456)
 * Do every script using Meta Box need to inject the rwmb variable now? The original
   metabox is created by the theme that we are using and I found that there are 
   some Metabox customisations involved.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Meta Box] rwmb is not defined](https://wordpress.org/support/topic/rwmb-is-not-defined/)
 *  [codesxt](https://wordpress.org/support/users/codesxt/)
 * (@codesxt)
 * [6 years, 9 months ago](https://wordpress.org/support/topic/rwmb-is-not-defined/#post-11871882)
 * Here is the code that I use to add the clonable metaboxes to the corresponding
   Meta Box on the site:
 *     ```
       <?php
   
       if ( ! defined( 'WPINC' ) ) {
       	die;
       }
   
       add_filter( 'rwmb_meta_boxes', 'gcbti_add_tb_fields_to_tour', 20 );
       function gcbti_add_tb_fields_to_tour( $meta_boxes ) {
         foreach ( $meta_boxes as $k => &$meta_box ) {
           if ( isset( $meta_box['id'] ) && 'tour_default_details' == $meta_box['id'] ) {
             array_push(
               $meta_box['fields'],
               array(
                 'name'         => 'Travel Builder Services',
                 'id'           => "_tour_tb_services",
                 'desc'         => 'Ingrese el Service ID de Travel Builder',
                 'placeholder'  => 'Ingrese el ID',
                 'type'         => 'tb-services-list',
                 'service_type' => 'tour',
                 'clone' => true,
                 'clone_as_multiple' => true,
                 'add_button' => 'Añadir otro ID'
               ),
               array(
                 'name'         => 'Travel Builder Packages',
                 'id'           => "_tour_tb_packages",
                 'desc'         => 'Ingrese el Package ID de Travel Builder',
                 'placeholder'  => 'Ingrese el ID',
                 'type'         => 'tb-packages-list',
                 'service_type' => 'tour',
                 'clone' => true,
                 'clone_as_multiple' => true,
                 'add_button' => 'Añadir otro Paquete'
               )
             );
           }
         }
         return $meta_boxes;
       }
       ```
   
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Meta Box] rwmb is not defined](https://wordpress.org/support/topic/rwmb-is-not-defined/)
 *  [codesxt](https://wordpress.org/support/users/codesxt/)
 * (@codesxt)
 * [6 years, 9 months ago](https://wordpress.org/support/topic/rwmb-is-not-defined/#post-11867776)
 * I’ve just disabled all of my custom plugins that use Meta Box functionality and
   the error still persists.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Meta Box] rwmb is not defined](https://wordpress.org/support/topic/rwmb-is-not-defined/)
 *  [codesxt](https://wordpress.org/support/users/codesxt/)
 * (@codesxt)
 * [6 years, 9 months ago](https://wordpress.org/support/topic/rwmb-is-not-defined/#post-11867756)
 * From Meta Box we are only using Meta Box and Meta Box Group. I have also developed
   some custom fields and pages.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Meta Box] rwmb is not defined](https://wordpress.org/support/topic/rwmb-is-not-defined/)
 *  [codesxt](https://wordpress.org/support/users/codesxt/)
 * (@codesxt)
 * [6 years, 10 months ago](https://wordpress.org/support/topic/rwmb-is-not-defined/#post-11861963)
 * I’m also getting the same error with other files:
    clone.js:270:1 date.js:68:
   1
 * I have updated to the latest version (5.1.1) and cleared the cache many times.
 * When I see the console, it seems like /meta-box/js/script.js, which defines rwmb,
   is being loaded AFTER many scripts (including the ones that give me the error)
   which might be the cause of the scripts not finding rmwb. Maybe the enqueue order
   has a problem. I’m not sure.

Viewing 7 replies - 1 through 7 (of 7 total)