WordPress.org

Ready to get started?Download WordPress

Forums

Bug while adding post via wp_insert_post (2 posts)

  1. Lostman
    Member
    Posted 5 years ago #

    Hi.

    I've got a problem with inserting post manually via wp_insert_post function.

    Problem description: <img src="...url..."/> tags were converted to <img> (with no attributes).

    How to fix:
    The closing slash '/' breaks WP. The bug is in kses.php:wp_kses_split2 function.
    Change (note '?)/?' at the end of regexp) this line
    if (!preg_match('%^<\s*(/\s*)?([a-zA-Z0-9]+)([^>]*)>?$%', $string, $matches))
    to
    if (!preg_match('%^<\s*(/\s*)?([a-zA-Z0-9]+)([^>]*?)/?>?$%', $string, $matches)).

    Hope that helps.

  2. 123extra
    Member
    Posted 5 years ago #

    thanks for the solution, but its there any way to do it by not hacking the kses.php?
    like some function to avoid the kses function??

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.