WordPress.org

Make WordPress Core

Ticket #23050: 23050-ala-23757.diff

File 23050-ala-23757.diff, 928 bytes (added by beaulebens, 7 years ago)

Ignore links within link a la code/pre blocks

  • wp-includes/formatting.php

     
    16961696        $nested_code_pre = 0; // Keep track of how many levels link is nested inside <pre> or <code>
    16971697        foreach ( $textarr as $piece ) {
    16981698
    1699                 if ( preg_match( '|^<code[\s>]|i', $piece ) || preg_match( '|^<pre[\s>]|i', $piece ) )
     1699                if ( preg_match( '/^<(?:code|pre|a)[\s>]/i', $piece ) )
    17001700                        $nested_code_pre++;
    1701                 elseif ( ( '</code>' === strtolower( $piece ) || '</pre>' === strtolower( $piece ) ) && $nested_code_pre )
     1701                elseif ( $nested_code_pre && ( '</a>' === strtolower( $piece ) || '</code>' === strtolower( $piece ) || '</pre>' === strtolower( $piece ) ) )
    17021702                        $nested_code_pre--;
    17031703
    17041704                if ( $nested_code_pre || empty( $piece ) || ( $piece[0] === '<' && ! preg_match( '|^<\s*[\w]{1,20}+://|', $piece ) ) ) {