• I added 2 records for a custom post type manually, and 100 via a php script. The database rows look exactly the same for bot the manual and scripted entries (except for the IDs)

    All show up in my custom view in the WP Admin… but only the two manually entered show up on the actual WordPress page meant to show all from the custom post type.

    Please help.

Viewing 2 replies - 1 through 2 (of 2 total)
  • As a guess, I would look for records in postmeta (and possible other tables) that are there for the 2 manual ones and missing for the script ones.

    Thread Starter jmastrom

    (@jmastrom)

    Thanks!

    It was really strange. All the term_relationships and post_meta was there. I have no idea what fixed it.

    I ended up figuring out how to use wp_insert_post() and add_post_meta(), but I just can;t believe that their is a difference in how they are inserted

    Now, If I can only figure out how to replace:
    $term_values=array(1,2,3,);
    foreach($term_values as $_in){
    $sql=”INSERT INTO wp_term_relationships (object_id, term_taxonomy_id) VALUES($db_row, $_in)”;
    $r_=mysql_query($sql);
    }

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Adding records via SQL’ is closed to new replies.