WordPress.org

Ready to get started?Download WordPress

Forums

Possible Broken Post Name Check? (2 posts)

  1. srp0uk
    Member
    Posted 6 years ago #

    I have a plugin that uses wp_insert_post to add posts to the database.

    wp_insert_post is attempting to get the post_name by sanitizing the post_title and adding hyphens.

    Fine, although it removes slashes (which I nicely put in) with stripslashes and relies on the new insert function to use add_magic_quotes to put them back.

    That is all fine and good, but wp_insert_post actually uses the post_name in a query before it ever gets to the insert function. The post_name_check part of wp_insert_post, to be precise.

    What does this mean?

    When a post title has a dodgy character, for example the apostrophe ' in Can't, it doesn't like it one bit, and hangs at post_name_check.

  2. Ivovic
    Member
    Posted 6 years ago #

    if it were broken, it would break when posting normally too right?

    maybe you just need to find out what the act of posting normally sends to this function, and feed it the same thing. If it needs to be escaped or encoded in some way, just do what wp's doing.

    I'm just talking out of my arse here, but that seems logical, right?

Topic Closed

This topic has been closed to new replies.

About this Topic