• The guid value is always empty for post_type=attachemnt in wp_posts table.

    I am passing the guid correctly, but nothing will be stored in the related field.

    function wp_insert_attachment($object, $file = false, $parent = 0) {
    global $wpdb, $user_ID;

    $defaults = array(‘post_status’ => ‘inherit’, ‘post_type’ => ‘post’, ‘post_author’ => $user_ID,
    ‘ping_status’ => get_option(‘default_ping_status’), ‘post_parent’ => 0,
    ‘menu_order’ => 0, ‘to_ping’ => ”, ‘pinged’ => ”, ‘post_password’ => ”,
    ‘guid’ => ”, ‘post_content_filtered’ => ”, ‘post_excerpt’ => ”, ‘import_id’ => 0, ‘context’ => ”);

Viewing 3 replies - 1 through 3 (of 3 total)
  • 'guid' => '' means guid must be empty.

    Thread Starter startecommerce2

    (@startecommerce2)

    ‘gui’ => ” means it should take the default value and the default URL/GUID format

    I don’t know the context, where do you use wp_insert_attachment()
    If in custom plugin etc., did you try this example from the Codex?
    'guid' => $wp_upload_dir['url'] . '/' . basename( $filename )

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘guid field is empty for attachment in wp_posts’ is closed to new replies.