• Resolved purbeckpixels

    (@purbeckpixels)


    Me again.

    I have an odd issue with the auto import of a .csv file. The file contains HTML in several table cells e.g.

    <span rel="tooltip" title="£20.80">0.05</span>

    Manually importing the file works just fine, all the HTML is imported. But, when I enable auto import of the same .csv file the rel="tooltip" attribute is stripped/not imported e.g.

    <span title="£20.80">0.05</span>

    Any idea why this is happening?

    Thanks.

    https://wordpress.org/plugins/tablepress/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    thanks for your post, and sorry for the trouble.

    The reason for this most likely lies in the way how WordPress triggers an auto update.
    It does so using it’s WP Cron system, which basically runs (once needed) in the background of a regular user request.
    Due to that, it runs without a user being logged-in. However, when no user is logged-in, WordPress employs additional security checks to the content that is to be saved. One example here is that it strips HTML code (or attributes) that is invalid/disallowed/unsafe from the content, before it saved to the database.
    My assumption is that this is what’s happening here.

    Regards,
    Tobias

    Thread Starter purbeckpixels

    (@purbeckpixels)

    Thanks, Tobias. That was indeed the issue.

    WordPress’s built-in kses.php file doesn’t allow rel attributes in span. Fixed it by creating a function in the theme’s functions.php file that replaces kses.php’s $allowedposttags array with my own that allows rel in span.

    Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    yes, that’s the technical internals 🙂 Good to hear that you found this and were able to work around it!

    Best wishes,
    Tobias

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Auto import stripping HTML?’ is closed to new replies.