Set a custom consecutive post ID
-
Hi everyone
We are about to relaunch a Website with wordpress.
So far the old page provided an API with events. Every event had a unique identifier ID (which is adding up, currently around 31000)On our new page we want to prevent problems with duplicate IDs and would like to either manipulate the post ID, to make our first post (event) ID start from let’s say 40000, or to set a second, custom post ID, which also increases by 1 for every new post.
I searched the web and the forum but could not find anything.
Does somebody have an idea how to accomplish this task?As a fallback solution I also thought about letting the post ID be whatever it is (default, starting from 1), but in our API we just add 40000 to the ID and generate an ?artificial? ID, whose only purpose is to be higher than 31000 and only appears in our API.
Here is an example of the API JSON, just as a reference:
{ "31424": { "field_event_origin_id": "31424", "changed": 1524129659, "title": "Christian L\u00f6ffler (live)", "field_event_subtitle": "Club: Electronica, pr\u00e4sentiert mit h\u00f6rperlen.", "field_event_image": "http:\/\/www.mypage.ch\/sites\/default\/files\/image.jpg", "body": "Text Text text", "field_event_date": 1537560000, "field_event_doors": 1537560000, "field_event_doors_string": "22:00", "field_event_doors_datetime": "2018-09-21T22:00:00", "field_event_ticket_link": "https:\/\/www.linktoticket.com", "field_event_origin_link": "http:\/\/www.mypage.ch\/#31424", "field_event_youtube_clip_id": "ee9nxjua30U", "field_event_soundcloud_clip_id": null, "field_event_vimeo_clip_id": null, "field_event_price": "CHF 25", "field_event_facebook_event_id": null }, "31426": { "field_event_origin_id": "31426", "changed": 1524129659, "title": "Sommerfest - mit Shahin Najafi", "field_event_subtitle": "Grosse Halle: iranischer Pop-Rock, Worldpol, pr\u00e4sentiert mit Verein Yari", "field_event_image": "http:\/\/www.mypage.ch\/sites\/default\/files\/Sommerfest_18_digi2_0.png", "body": "Text Text text", "field_event_date": 1529780400, "field_event_doors": 1529780400, "field_event_doors_string": "21:00", "field_event_doors_datetime": "2018-06-23T21:00:00", "field_event_ticket_link": "https:\/\/www.linktoticket.com", "field_event_origin_link": "http:\/\/www.mypage.ch\/#31426", "field_event_youtube_clip_id": "hX4vBjFH2sI", "field_event_soundcloud_clip_id": null, "field_event_vimeo_clip_id": null, "field_event_price": "CHF 30", "field_event_facebook_event_id": null }, }
(Just two events, should be enough…)
Thanks for your help. Much appreciated.
Cheers
- The topic ‘Set a custom consecutive post ID’ is closed to new replies.