MaisonBisson.com

  • Home
  • About
    • About Casey
    • Contact
  • Nest
    • Cocktails
    • Food
    • Making House
  • Dead Letter Box
    • Emails
    • Photos
    • Videos
  • OSS4Lib
    • About
    • Contents
  • Projects
    • bSuite 4
      • Shortcodes
      • Widgets
    • Hot Dog Menu
    • New Hampshire RSA Search
    • Phonepedia
    • The Google Economy
    • September 11th Pager Texts Archive
    • Scriblio
    • wpSMS
    • wpCAS
  • Comments · Explore
  • Find Us On Facebook

  • Related Posts

    • bsuite Bug Fixes (release b2v7)
    • WordPress Bug In setup_postdata()
    • WP Memcache Object Cache Breaks HTTP HEAD Requests
    • bsuite Bug Fixes (release b2v3)
    • bsuite Bug Fixes (release b2v6)
    • WordPress MU/MS Empty Header and Broken Image Bug Fixed
    • Testing apply_filters() times
« Clarity from a distance  |   Canon + iOS tethering solutions »

WordPress Bug: Duplicate post_meta Entries

I just submitted a trac ticket about this:

The update_post_meta() and delete_post_meta() functions don’t know how to deal with post revision IDs. add_post_meta() does, it uses the following block of code to make sure the passed $post_id is a real post, not a revision:

if ( $the_post = wp_is_post_revision($post_id) )
	$post_id = $the_post;

This is important because the global $post_id when a post is being saved is for the revision, not the real post. If you pass that to these functions, update_post_meta() and delete_post_meta() will try to update or delete the records related to the revision. When update_post_meta() fails to find any records for the post_id you submitted, it calls add_post_meta(). Each attempt at updating the meta will actually create a new row in the table.

For now I’m checking with wp_is_post_revision() before making any calls to the post_meta functions.

Updated: Mark Jaquith committed the patch less than two hours after I submitted it! I love WP.

Posted on Monday, October 20th, 2008 at 12:00 am in Technology   |  RSS feed

Tags: bug, delete_post_meta(), meta, post meta, update_post_meta(), wordpress, wp_is_post_revision()

2 Comments to “WordPress Bug: Duplicate post_meta Entries”

    
  1. Mark Jaquith
    October 22, 2008 at 2:20 pm

    Not as much as I love you for finding it! This bug was driving me absolutely insane.

  2. Danmark Bag Facaden
    December 16, 2009 at 7:19 am

    i was lookin for a way to prevent duplicate posts from news feeds ( NyhedsLinks ) on my blog in wordpress… il just keep looking, thx ;o)

    

User contributed tags for this post:

Related Posts

  • WordPress MU/MS Empty Header and Broken Image Bug Fixed
  • URL Path Bug In WordPress.com Video Server
  • WP Memcache Object Cache Breaks HTTP HEAD Requests
  • WordPress Bug In setup_postdata()
  • Uploading .docx Files In WordPress
  • Many Eyes, Bugs Being Shallow, All That
  • bsuite Bug Fixes (release b2v7)
loading external resource {"source":"http:\/\/maisonbisson.com\/oss4lib\/wijax\/22a09551cfcc2ff6028d0d95c1224809","varname":"wijax_7e2862b85b84299f4131f540c6edddd8","title_element":"h2","title_class":"","title_before":"%3Ch2%3E","title_after":"%3C%2Fh2%3E%3Cdiv%20class%3D%22line%22%3E%3C%2Fdiv%3E"}

Recently Commented

  • Steve Jobs On Apple vs. Adobe and iPhone vs. Flash
  • Improving P2 — Order Posts By Last Comment Date
  • College Students Use, Love, Are Aware Of The Limitations Of Wikipedia
  • Connect-a-Desk Looks Ridiculous (though I may secretly want one)
  • Addressing Hateful And Libelous Internet Speech In The Post Juicy Campus Era
  • I’ll Stop The World and Melt With You
  • Valentine’s Rose (O’Keefe View)
loading external resource {"source":"http:\/\/maisonbisson.com\/nest\/wijax\/22a09551cfcc2ff6028d0d95c1224809","varname":"wijax_ca29dee224562d25c361aa66a968f78d","title_element":"h2","title_class":"","title_before":"%3Ch2%3E","title_after":"%3C%2Fh2%3E%3Cdiv%20class%3D%22line%22%3E%3C%2Fdiv%3E"}
loading external resource {"source":"http:\/\/DrunkenDial.Us\/wijax\/c60dd0bd0908d447e490e0efe458c5b9","varname":"wijax_67db8f09c5eed6319af74e887ce7c6fc","title_element":"h2","title_class":"","title_before":"%3Ch2%3E","title_after":"%3C%2Fh2%3E%3Cdiv%20class%3D%22line%22%3E%3C%2Fdiv%3E"}

Tags

apple blog blogging bsuite bush copyfight education flickr food funny future libraries future of library catalogs george w bush google google economy hack internet iphone ipod lib20 libraries library library 2.0 library catalogs mac os X movie music mysql opac open source performance photo photography php plugin social software video web 2.0 web applications web design web development WordCamp wordpress wordpress plugin WordPress Plugins
loading external resource {"source":"http:\/\/musictotakeyourclothesoffto.com\/wijax\/22a09551cfcc2ff6028d0d95c1224809","varname":"wijax_5df337a812da2923bb4b126afc75234e","title_element":"h2","title_class":"","title_before":"%3Ch2%3E","title_after":"%3C%2Fh2%3E%3Cdiv%20class%3D%22line%22%3E%3C%2Fdiv%3E"}
loading external resource {"source":"http:\/\/becomingdonnareed.com\/wijax\/6c67c5dde121f50e789efc8646d8facd","varname":"wijax_dd2cc597c58c010e92b6d7867680d6e4","title_element":"h2","title_class":"","title_before":"%3Ch2%3E","title_after":"%3C%2Fh2%3E%3Cdiv%20class%3D%22line%22%3E%3C%2Fdiv%3E"}

Around MaisonBisson

  • Home
  • About
    • About Casey
    • Contact
  • Nest
    • Cocktails
    • Food
    • Making House
  • Dead Letter Box
    • Emails
    • Photos
    • Videos
  • OSS4Lib
    • About
    • Contents
  • Projects
    • bSuite 4
      • Shortcodes
      • Widgets
    • Hot Dog Menu
    • New Hampshire RSA Search
    • Phonepedia
    • The Google Economy
    • September 11th Pager Texts Archive
    • Scriblio
    • wpSMS
    • wpCAS
Get a free blog at WordPress.com | Theme: Under the Influence by spaceperson.