[wp-hackers] Unique Page field
brent at prospress.org
Fri Jan 28 23:15:27 UTC 2011
I wasn't storing the post_name, I was setting it on post creation and relying on it not changing. This meant I knew the post_name field on all installations without data duplication, as long as the permalink wasn't changed, which of course some folks want to do.
On 29/01/2011, at 5:58 AM, Brent Shepherd <brent.e.shepherd at gmail.com> wrote:
> I wasn't storing the post_name, I was setting it on post creation and relying on it not changing. This meant I knew the post_name field on all installations with data fuplication, as long as it wasn't changed.
> On 29/01/2011, at 5:20 AM, "Dion Hulse (dd32)" <wordpress at dd32.id.au> wrote:
>> On Sat, 29 Jan 2011 04:40:10 +1100, Brent Shepherd <brent at prospress.org> wrote:
>>> 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/
>> wp-hackers mailing list
>> wp-hackers at lists.automattic.com
More information about the wp-hackers