WordPress.org

Support

Support » How-To and Troubleshooting » add 3 fields in wp_post table will make crash the updates ?

add 3 fields in wp_post table will make crash the updates ?

  • All is in the title.

    if I add 3 fields in the wp_post table, will my future updates be the hell ?

    Thanks for the answer of a major developper or someone I can trust blind please.

    If there won’t be any problem, I work since 2 weeks on something totally useless… but I would prefer in fact 🙂

Viewing 4 replies - 1 through 4 (of 4 total)
  • If I’m interpreting your question correctly…

    Yes, any *custom* records added to the posts table will be dropped the next time WordPress is updated.

    The best option is to create your own table in the database for whatever you’re doing, but add a column to it providing the post ID. Then for any querying requiring both bits of data (that from the posts table and yours), just join on the ID from the posts table and yours.

    Hi,

    Thanks a lot for your reply. I have create my separate table ans have add a colum “post-id” to provide the post-id.

    Now I’m stopped by another thing and perhaps you can make it disappear : I don’t succeed to find inside the WP Core where is the query to insert data in the database. In Wp 1.5 it was in “post.php”, in WP 2… ? There is nothing in “post.php” or “edit.php” or “form-advanced.php”. I’m lost between versions.

    I want to insert more things when publish, I have made a plugin to add fields in the admin panel (dates fields). But I need to make my new data go into my new table in the same time the post is publish in a classic way. So I must hack the core query and impossible to find it… !

    If someone knows a way to make this whithout touching to the wp core, I’m fully interested.

    I think I have found it in wp-includes/functions-post.php :


    $wpdb->query(
    "INSERT INTO $wpdb->posts
    (post_author, post_date, post_date_gmt, post_content, post_title, post_excerpt, post_status, comment_status, ping_status, post_password, post_name, to_ping, pinged, post_modified, post_modified_gmt, post_parent, menu_order, post_mime_type, guid)
    VALUES
    ('$post_author', '$post_date', '$post_date_gmt', '$post_content', '$post_title', '$post_excerpt', '$post_status', '$comment_status', '$ping_status', '$post_password', '$post_name', '$to_ping', '$pinged', '$post_date', '$post_date_gmt', '$post_parent', '$menu_order', '$post_mime_type', '$guid')");

    But it doesn’t help me a lot. I’m a bit afraid by this. How to make a LEFT JOIN in THIS query ??? If a Mysql professor read this, give me a graduate lesson please…

    I’m always on this way : http://wordpress.org/support/topic/94218?replies=4

    That’s why I need a help for Mysql synthax.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘add 3 fields in wp_post table will make crash the updates ?’ is closed to new replies.