Opened 10 years ago
Last modified 22 months ago
#29821 new defect (bug)
bulk_edit_custom_box hook causes tags to display within created fieldset
Reported by: | webgeekconsulting | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | 4.0 |
Component: | Quick/Bulk Edit | Keywords: | needs-testing needs-patch |
Focuses: | Cc: |
Description
I have a custom post type that I am trying to add some fields to for bulk editing. My fieldset displays, but the tags field somehow is getting inserted into the fieldset being generated. It's extremely strange.
Bulk Edit panel without my fieldset:
Bulk Edit panel with my fieldset:
My code to generate the bulk edit custom box:
/** * Display the custom bulk edit box * * @since 3.0 * @access public * @action bulk_edit_custom_box */ public function bulk_edit_custom_box( $column_name, $post_type ) { if ( $post_type != MP_Product::get_post_type() || $column_name != 'product_price' ) { return; } ?> <fieldset id="bulk-edit-col-product-price" class="inline-edit-col-left" style="clear:left"> <div class="inline-edit-col clearfix"> <label class="alignleft"><span class="title"><?php _e('Price', 'mp'); ?></span><span class="input-text-wrap"><input type="text" name="product_price" style="width:100px" /></span></label> <label class="alignleft" style="margin-left:15px"><span class="title"><?php _e('Sale Price', 'mp'); ?></span><span class="input-text-wrap"><input type="text" name="product_sale_price" style="width:100px" /></span></label> <input type="hidden" name="bulk_edit_product_nonce" value="<?php echo wp_create_nonce('bulk_edit_product'); ?>" /> </div> </fieldset> <?php }
This is the code that is being generated in my debugger:
<fieldset id="bulk-edit-col-product-price" class="inline-edit-col-left" style="clear:left"><label class="inline-edit-tags"> <span class="title">Product Tags</span> <textarea cols="22" rows="1" name="tax_input[product_tag]" class="tax_input_product_tag"></textarea> </label> <div class="inline-edit-col clearfix"> <label class="alignleft"><span class="title">Price</span><span class="input-text-wrap"><input name="product_price" style="width:100px" type="text"></span></label> <label class="alignleft" style="margin-left:15px"><span class="title">Sale Price</span><span class="input-text-wrap"><input name="product_sale_price" style="width:100px" type="text"></span></label> <input name="bulk_edit_product_nonce" value="5e55f56276" type="hidden"> </div> </fieldset>
Notice how the tags field is being inserted into my fieldset. It seems as thought the tags field is being inserted via javascript into whatever the last fieldset in the panel is.
Here's the same fields in the quick edit panel:
This is how it should show up.
Change History (10)
This ticket was mentioned in Slack in #core by abhanonstopnews. View the logs.
3 years ago
#6
@
22 months ago
- Keywords needs-testing reporter-feedback added
Component bug scrub/ review, January 30, 2023
- This is an old ticket and those attending will test whether the problem can be recreated in the latest version of WordPress.
- Last test in 2022 could not recreate the issue in 6.0.
- Testers to report findings on the ticket.
- Reporter feedback on whether this issue is still occurring. Note: the original images are missing from the description due to the age of this ticket. This may make comparing any re-creation of the issue more difficult.
Scrub attended by: @webcommsat, @marybaum, @nalininonstopnewsuk, @oglekler, @robinwpdeveloper
This ticket was mentioned in Slack in #core by abhanonstopnews. View the logs.
22 months ago
#8
@
22 months ago
The action 'bulk_edit_custom_box' is working only if table has additional custom column,
see: wp-admin/includes/class-wp-posts-list-table.php#L1999
But this inserting is happening on the admin frontend,
see: wp-admin/js/inline-edit-post.js#L131
$('#bulk-edit').find('fieldset:first').after( $('#inline-edit fieldset.inline-edit-categories').clone() ).siblings( 'fieldset:last' ).prepend( $( '#inline-edit .inline-edit-tags-wrap' ).clone() );
This implementation with insertion after first or to the beginning of the last element look very uncertain. To make it clear, there should be exact places to add elements, but also it is possible that we are lacking developers documentation on the subject. I wasn't able to find it on the WordPress.org. I found only a post "Custom Fields in Bulk Edit" in personal blog of Misha Rudrastyh.
So, I am suggesting to rework inserting elements into the Bulk Editor and check if we need in-house documentation on the subject.
#9
@
22 months ago
- Keywords needs-patch added; reporter-feedback removed
Component review today
- The issue was found in testing to still occur and in the current version of WP.
- This would need a patch.
- Added comments from @oglekler above and that this would not be patch for a first task (note we are reviewing tickets which could be worked on at WCAsia contributor day next week).
I'm having this issue as well in WP 4.3. Did anyone ever look into this?