Make WordPress Core

Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#35349 closed enhancement (fixed)

Tag meta-boxes do not offer suggestions in custom contexts

Reported by: johnjamesjacoby's profile johnjamesjacoby Owned by: boonebgorges's profile boonebgorges
Milestone: 4.5 Priority: normal
Severity: normal Version:
Component: Taxonomy Keywords: has-patch commit
Focuses: javascript Cc:


I'm registering a custom metaboxes before and after TinyMCE like this:

add_action( 'edit_form_after_title',  'jjj_editor_above' );
add_action( 'edit_form_after_editor', 'jjj_editor_below' );

These look like:

do_meta_boxes( $GLOBALS['post_type'], 'above_editor', $GLOBALS['post'] );
do_meta_boxes( $GLOBALS['post_type'], 'below_editor', $GLOBALS['post'] );

When you drag a non-hierarchical taxonomy meta-box into one of these custom areas and reload the page, jQuery Suggest stops working. This is because:

post.js targets '#side-sortables, #normal-sortables, #advanced-sortables'

...when it could target...


I can fix this myself by copying that bit from post.js (see below) but, I think WordPress core can safely prevent plugins from needing to handle this on their own:

/* Custom Meta Box Locations */
$( '#above_editor-sortables, #below_editor-sortables' ).children( 'div.postbox' ).each( function() {
	if ( 'tagsdiv-' ) === 0 ) {
		window.tagBox && window.tagBox.init();
		return false;
} );

Attachments (1)

35349.1.patch (551 bytes) - added by johnjamesjacoby 8 years ago.

Download all attachments as: .zip

Change History (5)

#1 @adamsilverstein
8 years ago

  • Keywords commit added; 2nd-opinion removed
  • Type changed from defect (bug) to enhancement

@johnjamesjacoby this looks like a reasonable enhancement; its a very small change that earns us some more flexibility with using tags on the post page. the only possible side effects i see would be unexpected application for .meta-box-sortables areas which seems unlikely.

I tested the patch and verified core tags still work as expected.

#2 @boonebgorges
8 years ago

  • Milestone changed from Awaiting Review to 4.5

Looks like a good change to me.

#3 @boonebgorges
8 years ago

  • Owner set to boonebgorges
  • Resolution set to fixed
  • Status changed from new to closed

In 36227:

Use a more generous selector when setting up tag suggestion.

This allows taxonomy metaboxes to be registered in a greater variety of
locations on the Dashboard.

Props johnjamesjacoby..
Fixes #35349.

#4 @johnjamesjacoby
8 years ago

Thank you both!

Note: See TracTickets for help on using tickets.