WordPress.org

Support

Support » Requests and Feedback » Bug while adding post via wp_insert_post

Bug while adding post via wp_insert_post

  • 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.

Viewing 1 replies (of 1 total)
  • 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??

Viewing 1 replies (of 1 total)
  • The topic ‘Bug while adding post via wp_insert_post’ is closed to new replies.