• I’m nearly finished writing my conversion script to WordPress, however, I have a question about inserting content into the database.

    Looking at posts.php inside wp-admin, I saw that the ‘post_content’ is put through this function:

    $content = apply_filters('content_save_pre', $_POST['content']);

    Well, I changed that to work with my conversion:

    $wp_posts_post_content =apply_filters('content_save_pre', $story["CONTENT_SEARCH"]);

    I then tried running my query, and got an error, something to do with the content. So I put in addslashes ():

    $wp_posts_post_content = addslashes (apply_filters('content_save_pre', $story["CONTENT_SEARCH"]));

    And the query went through fine.

    But I’m confused. How comes the wp-admin/posts.php file does not addslashes? It obviously isn’t done in the filter, and I can’t see it anywhere?

Viewing 2 replies - 1 through 2 (of 2 total)
  • content_save_pre is a Plugin Hook, for plugins to have access to the post contents before it’s modified by other plugins and ultimately saved to the database.

    The file wp-includes/default-filters.php includes a single reference to content_save_pre:
    add_filter('content_save_pre', 'balanceTags', 50);

    I don’t think you want to use content_save_pre for your conversion script.

    Thread Starter commanderbond

    (@commanderbond)

    I’m only using it because the actual Admin page uses it to insert it into the Database.

    So if that uses it for the form posted data, isn’t it a good idea to use it for the conversion to be sure all the WordPress stuff is done as if I was doing it all manually via the Admin.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘‘content_save_pre’ doesn’t add slashes?’ is closed to new replies.