Support » Plugins » How does wordpress treat tags on insertion?

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


Viewing 5 replies - 1 through 5 (of 5 total)
  • *bump*

    Moderator Samuel Wood (Otto)

    (@otto42) Admin

    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?


    perhaps that’s why I didn’t get any replies 😀

    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?

    Moderator Samuel Wood (Otto)

    (@otto42) Admin

    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.


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

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How does wordpress treat tags on insertion?’ is closed to new replies.