Support » Plugins » Hacks » GUID column issues.

  • I an using the guid cloumn to store a uuid. I also added a uuid column to the post table as a backup if there was ever a problem. After a recent update WP is prepending my UUID value with “http://”.

    For example “2C3467A6-2765-478F-81C9-8013F1D623B9” becomes “http://2C3467A6-2765-478F-81C9-8013F1D623B9”

    This is causing some problems and I need to fix it. Below is the function I am using to do this.

    function wpufe_update_uuid( $post_id ) {
    
    	$uuid = get_post_meta( $post_id, '_uuid', true );
    	global $wpdb;
    	$wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET guid = %s WHERE ID = %d", $uuid, $post_id ) );
    	$wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET uuid = %s WHERE ID = %d", $uuid, $post_id ) );	
    
    	}
    
    add_action( 'wpuf_add_post_after_insert', 'wpufe_update_uuid' );
    add_action( 'wpuf_edit_post_after_update', 'wpufe_update_uuid' );
Viewing 1 replies (of 1 total)
  • Thread Starter btgjp

    (@btgjp)

    It would be nice if WordPress would just support a post UUID field out of the box. How hard would that really be? From what I can see people have been asking for it for a while.

Viewing 1 replies (of 1 total)
  • The topic ‘GUID column issues.’ is closed to new replies.