Make WordPress Core


Ignore:
Timestamp:
07/16/2014 10:04:08 PM (10 years ago)
Author:
wonderboymusic
Message:

Make has_shortcode() recursive/work for nested shortcodes.

Adds unit test.

Props katzwebdesign.
Fixes #26343.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/shortcode.php

    r28716 r29197  
    395395        }
    396396    }
     397
     398    /**
     399     * @ticket 26343
     400     */
     401    function test_has_shortcode() {
     402        $content = 'This is a blob with [gallery] in it';
     403        $this->assertTrue( has_shortcode( $content, 'gallery' ) );
     404
     405        add_shortcode( 'foo', '__return_false' );
     406        $content_nested = 'This is a blob with [foo] [gallery] [/foo] in it';
     407        $this->assertTrue( has_shortcode( $content_nested, 'gallery' ) );
     408        remove_shortcode( 'foo' );
     409    }
    397410}
Note: See TracChangeset for help on using the changeset viewer.