Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #60948


Ignore:
Timestamp:
04/06/2024 07:24:00 PM (10 months ago)
Author:
sabernhardt
Comment:

The trimming was added in [33600] / #33259.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #60948

    • Property Component changed from General to Shortcodes
  • Ticket #60948 – Description

    initial v1  
    11shortcodes that return with no value / text will break if shortcode is being used as an attribute value. Shortcode works in this scenario if there is text / value returned.
    22
    3 eg: <input type="email" class="regular-text ltr form-required"  id="imok_contact_email_1"
     3eg:
     4{{{
     5<input type="email"     class="regular-text ltr form-required"  id="imok_contact_email_1"
    46name="imok_contact_email_1" value=[imok_contact_email_1] title="Please enter a valid email address."    required>
     7}}}
    58
    69if [imok_contact_email_1] returns an empty string, the result of the input tag above is:
     10{{{
    711<input type="email" class="regular-text ltr form-required"
    812id="imok_contact_email_1" name="imok_contact_email_1"
    913value=  title="Please enter a valid email address." required>
     14}}}
    1015
    1116This mangles the html output and the attribute for value becomes:
    12 value="title="Please"
     17`value="title="Please"`
    1318
    1419Placing the shortcode between quotes fails for the following reason:
    15 See: https://core.trac.wordpress.org/ticket/34983
     20See: #34983
    1621
    17 Offending code is in shortcodes.php
    18 function do_shortcodes_in_html_tags
     22Offending code is in `shortcodes.php`
     23function `do_shortcodes_in_html_tags`
    1924line:
    20 if ( '' !== trim( $new_attr ) ) {
     25`if ( '' !== trim( $new_attr ) ) {`
    2126I am not sure why that line exists.