WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] wptexturize keeps texturizing my shortcode (2 posts)

  1. pleasureinstitute
    Member
    Posted 1 year ago #

    I have a script outside of WordPress that generates an HTML file a few hundred times a day. I figured the best way to get the contents of this file in to a specific page would be a shortcode. I wrote one that looks something like this:

    function get_special_content($atts) {
        remove_filter('the_content', 'wpautop');
        remove_filter('the_content', 'wptexturize');
        return file_get_contents('/somewhere/somefile.html');
    }
    add_shortcode('SPECIAL_SHORTCODE', 'get_special_content');

    It works great, however the problem is that wptexturize is trashing the HTML. I have a few lines that look like this:

    <tr data-notes="Blah - Blah">...</tr>

    However the output that gets sent to the browser looks like this:

    <tr data-notes="Blah – Blah>...</tr>

    Notice that the closing " is removed!

    I thought calling the remove_filter() inside the shortcode function would remove it but apparently not. I've also tried setting priorities to 1, 9, 10, 11, and 99. I've also tried this and and nothing works.

  2. pleasureinstitute
    Member
    Posted 1 year ago #

    Turns out it was my theme doing some extra processing.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags