[wp-hackers] Unique Page field

Dion Hulse (dd32) wordpress at dd32.id.au
Fri Jan 28 22:20:44 UTC 2011

On Sat, 29 Jan 2011 04:40:10 +1100, Brent Shepherd <brent at prospress.org>  
> My plugin creates a page with "post_name" = "auctions". The plugin needs  
> to
> know when this page is being viewed. I was using checking the  
> "post_name",
> but that means no one can change the permalink for the page. If I was to
> store the post ID as an "auctions_page_id" option and check against the  
> ID,
> then I've got data duplication and the bunch of headaches that come with  
> it.

How is storing the ID cause more data duplication/headaches than storing  
the post_name?
The ID is the best item to store, It's WordPress's unique Identifier of  
the page.
You may even want to hook into the deletion hooks and prevent that ID from  
being deleted if your plugin depends on it.

Dion Hulse / dd32
  e: contact at dd32.id.au
  Web: http://dd32.id.au/

More information about the wp-hackers mailing list