[wp-trac] [WordPress Trac] #60948: shortcodes that return with no value / text will break if shortcode is being used as an attribute value

WordPress Trac noreply at wordpress.org
Tue Aug 13 04:42:14 UTC 2024


#60948: shortcodes that return with no value / text will break if shortcode is
being used as an attribute value
--------------------------+------------------------------
 Reporter:  vpelss        |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Shortcodes    |     Version:  6.5
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+------------------------------

Comment (by jikeneke):

 The issue arises because the [imok_contact_email_1] shortcode returns an
 empty string, breaking the HTML when used as an attribute without quotes.
 The line if ( '' !== trim( $new_attr ) ) { in shortcodes.php prevents
 empty values, leading to malformed HTML.

 To fix this, wrap the shortcode in quotes:

 <input type="email" class="regular-text ltr form-required"
 id="imok_contact_email_1" name="imok_contact_email_1"
 value="[imok_contact_email_1]" title="Please enter a valid email address."
 required>

 Alternatively, ensure the shortcode always returns a non-empty string to
 avoid breaking the HTML.

 <a href="https://kale-seo.com"></a>
 <a href="https://meganewsuk.tech"></a>
 <a href="https://news-usa.tech"></a>
 <a href="https://gamesnewsusa.tech"></a>
 <a href="https://iwanttechnews.tech"></a>
 <a href="https://iwanttechnews.store"></a>
 <a href="https://tech-news.tech"></a>
 <a href="https://skyboxbot.tech"></a>
 <a href="https://kitedu.tech"></a>
 <a href="https://techsilmy.shop"></a>
 <a href="https://skyrocketltd.online"></a>
 <a href="https://technewsltd.online"></a>
 <a href="https://americanberms.online"></a>
 <a href="https://totalhealthflex.tech"></a>
 <a href="https://maxandcara.tech"></a>
 <a href="https://bestricetrafficschool.tech"></a>
 <a href="https://jetdronetrip.tech"></a>
 <a href="https://marketingusluge.tech"></a>
 <a href="https://momentwins.tech"></a>
 <a href="https://webpartnerhunters.tech"></a>
 <a href="https://safedividendinvester.tech"></a>
 <a href="https://scottishdemocrats.tech"></a>
 <a href="https://technewsgg.tech"></a>
 <a href="https://netmodelshop.tech"></a>
 <a href="https://nrigloballink.shop"></a>
 <a href="https://officedutourismedem.store"></a>
 <a href="https://oilpaintingsource.store"></a>
 <a href="https://petcleanshop.store"></a>
 <a href="https://monotoneusa.tech"></a>
 <a href="https://ownersmanualcar.tech"></a>
 <a href="https://alisonbettles.tech"></a>
 <a href="https://mmphotos.shop"></a>
 <a href="https://upsidedowninsideout.tech"></a>
 <a href="https://cutandchat.online"></a>
 <a href="https://fireell.tech"></a>
 <a href="https://montrealvr.tech"></a>
 <a href="https://feelood.tech"></a>

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/60948#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list