WordPress.org

Ready to get started?Download WordPress

Forums

How does wordpress treat tags on insertion? (6 posts)

  1. walterego
    Member
    Posted 6 years ago #

    Hey guys,

    I can't seem to get my head around how wordpress insert new tags into the terms table. I want to copy this behaviour in a plugin, and send the tags to a different table then wordpress' native terms table.

    Walter

  2. walterego
    Member
    Posted 6 years ago #

    *bump*

  3. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

    Errr... I'm not quite sure I understand your question. Could you explain what it is that you want to actually do in more detail?

  4. walterego
    Member
    Posted 6 years ago #

    Hmm,

    perhaps that's why I didn't get any replies :-D

    I'm writing a social tagging plugin for WordPress (allows readers to submit their tags for posts). For this I need new tables in the db to store the user submitted tags in. I already have this working, but the tags aren't stored correctly (can't use WordPress' native function to store tags because it needs to go to a different table).

    WordPress stores foto's as foto's (dutch plural of photo), whereas my plugin stores it as foto\'s. Is there any way to prevent this?

  5. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

    Ah, I see. This is likely a magic_quotes problem.

    First, check to see whether or not the incoming tag has the slashes on it, before you stuff it into the database. The reason I say this is that WordPress automatically adds slashes to incoming content. This then gets slashed again when you run it through the database functions (this is called escaping), so you get that extra slash in there.

    So, check to see if your incoming tag data from $_GET or $_POST has the slashes already in it. If so, then run it through the PHP stripslashes() function before passing it to the database functions. If you're using WordPress' database functions (specifically, the $wpdb->insert($table, $data) function call), then it will handle sanitizing it properly for you.

  6. tgiokdi
    Member
    Posted 6 years ago #

    @walterego

    I've been looking for a plugin like that for a while now, did you get anywhere with it? want to publicly release it?

Topic Closed

This topic has been closed to new replies.

About this Topic