WordPress.org

Make WordPress Core

Opened 11 months ago

Closed 11 months ago

Last modified 11 months ago

#38104 closed defect (bug) (fixed)

form html tag is not properly closed, using {$taxonomy}_term_new_form_tag causes incorrect html output

Reported by: BjornW Owned by: SergeyBiryukov
Milestone: 4.7 Priority: normal
Severity: normal Version: 3.7
Component: Taxonomy Keywords:
Focuses: Cc:

Description

As you can see in edit-tags.php the html form tag is not properly closed:

<form id="addtag" method="post" action="edit-tags.php" class="validate"
<?php
/**
 * Fires at the beginning of the Add Tag form.
 *
 * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug.
 *
 * @since 3.7.0
 */
do_action( "{$taxonomy}_term_new_form_tag" );
?>>

This causes incorrect html output when using the {$taxonomy}_term_new_form_tag action.

Attachments (2)

38104.patch (831 bytes) - added by BjornW 11 months ago.
Patch which properly closes the form tag
38104-2.patch (586 bytes) - added by BjornW 11 months ago.
Clarify the intent and usage of the action in the docblock no code changes

Download all attachments as: .zip

Change History (11)

@BjornW
11 months ago

Patch which properly closes the form tag

#1 @BjornW
11 months ago

  • Keywords has-patch added

This ticket was mentioned in Slack in #core by bjornw. View the logs.


11 months ago

#3 follow-up: @ericlewis
11 months ago

This action is intended to be fired within the <form> tag to allow developers to add element attributes, eg the form encoding. See #15261.

#4 in reply to: ↑ 3 @BjornW
11 months ago

Hi @ericlewis,

Thanks for clearing this up, although I find this approach a bit strange. At least the action name should indicate that it is intended to be for adding additional attributes. I'd expect the current name to be used for adding new form fields above the default ones. I've added a new patch which makes the use of the action a bit clearer.

Replying to ericlewis:

This action is intended to be fired within the <form> tag to allow developers to add element attributes, eg the form encoding. See #15261.

@BjornW
11 months ago

Clarify the intent and usage of the action in the docblock no code changes

#5 @ericlewis
11 months ago

  • Milestone Awaiting Review deleted
  • Resolution set to worksforme
  • Status changed from new to closed

Thanks for the patch @BjornW! To keep our tickets in order, I've opened #38108 for the documentation issue. I'm closing this ticket as the original bug report has been dealt with.

#6 @ericlewis
11 months ago

  • Keywords has-patch removed

#7 @SergeyBiryukov
11 months ago

  • Owner set to SergeyBiryukov
  • Resolution changed from worksforme to fixed

In 38629:

Docs: Correct the description of {$taxonomy}_term_new_form_tag hook, making it more consistent with other *_form_tag hooks.

Props BjornW.
Fixes #38104.

#8 @SergeyBiryukov
11 months ago

  • Milestone set to 4.7
  • Version changed from trunk to 3.7

#9 @SergeyBiryukov
11 months ago

#38108 was marked as a duplicate.

Note: See TracTickets for help on using tickets.