Title: Javascript coding error in admin-options.js
Last modified: August 21, 2016

---

# Javascript coding error in admin-options.js

 *  Resolved [transom](https://wordpress.org/support/users/transom/)
 * (@transom)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/javascript-coding-error-in-admin-optionsjs/)
 * There is a coding error in your function custom_post_type_onomies_change_header_label
   around line 145:
 * Javascript doesn’t support default parameter values. The correct coding for this
   function is
 *     ```
       jQuery.fn.custom_post_type_onomies_change_header_label = function( $default_header_label ) {
       	if ( jQuery( this ).val() != '' )
       		jQuery( '#edit_custom_post_type_header .label' ).html( jQuery( this ).val() );
       	else if ( ! typeof($default_header_label) === 'undefined' )
       		jQuery( '#edit_custom_post_type_header .label' ).html( $default_header_label );
       }
       ```
   
 * Very useful plugin
 * [http://wordpress.org/plugins/cpt-onomies/](http://wordpress.org/plugins/cpt-onomies/)

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

 *  [Rachel Cherry](https://wordpress.org/support/users/bamadesigner/)
 * (@bamadesigner)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/javascript-coding-error-in-admin-optionsjs/#post-4018262)
 * Thanks for pointing this out!
 *  Thread Starter [transom](https://wordpress.org/support/users/transom/)
 * (@transom)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/javascript-coding-error-in-admin-optionsjs/#post-4018376)
 * Sorry to say – found another error in admin-edit.js [same problem]
 * Here is the part of the code I replaced:
 *     ```
       jQuery.fn.cpt_onomy_remove_from_quick_edit_checklist = function( $term_ids, $include ) {
   
       	if ( typeof $include === 'undefined' ) { $include = false; }
   
       	jQuery( this ).children( 'li' ).each( function() {
   
       		// retrieve item info
       		var $list_item = jQuery( this );
       		var $list_item_id = parseInt( $list_item.attr( 'id' ).match( /[0-9]+/ ) );
   
       		// remove item
       		// if $include is true, we're removing everything NOT in $term_ids
       		// otherwise, remove if in $term_ids
       		if ( ( $include && jQuery.inArray( $list_item_id, $term_ids ) == -1 )
       			|| ( ! $include && jQuery.inArray( $list_item_id, $term_ids ) > -1 ) )
       			$list_item.remove();
   
       	});
       }
       ```
   
 *  [Rachel Cherry](https://wordpress.org/support/users/bamadesigner/)
 * (@bamadesigner)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/javascript-coding-error-in-admin-optionsjs/#post-4018377)
 * After your initial message, I went through and removed all my supposed default
   parameters for the next update. Thanks!

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

The topic ‘Javascript coding error in admin-options.js’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/cpt-onomies_f2f2f2.svg)
 * [CPT-onomies: Using Custom Post Types as Taxonomies](https://wordpress.org/plugins/cpt-onomies/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/cpt-onomies/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/cpt-onomies/)
 * [Active Topics](https://wordpress.org/support/plugin/cpt-onomies/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/cpt-onomies/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/cpt-onomies/reviews/)

## Tags

 * [javascript](https://wordpress.org/support/topic-tag/javascript/)

 * 3 replies
 * 2 participants
 * Last reply from: [Rachel Cherry](https://wordpress.org/support/users/bamadesigner/)
 * Last activity: [12 years, 8 months ago](https://wordpress.org/support/topic/javascript-coding-error-in-admin-optionsjs/#post-4018377)
 * Status: resolved