• I am trying to create a plugin that stores specific data and associates it with the postID in a table my plugin creates.

    Currently my plugin adds some fields to the write a post page (under tags and categories). Once those are filled out, I use the publish_post hook. That seems to be the action I am looking for.. But whenever I try to use $wpdb->query to store what was in those fields, it seems to break. I get nothign but a white page. If I take the query out and just update options, or something else it works, but whenever I try to query the database (or call a function that queries the database) it breaks. Does anyone know what my problem is? Or where I can get some help on this action hook? Am I goign about this in the wrong way?

    Any help would be much appreciated.

Viewing 1 replies (of 1 total)
  • Thread Starter kylegetson

    (@kylegetson)

    Apparently you cant do it? I am able to use the add_post_meta function to save the information, but it’s not ideal. It seems as though I can do just about anything except use the $wpdb… it doesnt seem to be a scope issue. Anyone tried this before?

    more specifically:
    I am creating an ‘event’ type plugin that allows you to make an event on a post. so when writing a post you can give it a date/time, however i want to store this in a table I have created with my plugin. I can access the table without any problem outside of this hook, but when using publish_post I cant. I am forced to use add_post_meta and update_post_meta

Viewing 1 replies (of 1 total)
  • The topic ‘publish_post help/tutorial?’ is closed to new replies.