Home Forums ACF PRO Auto-incrementing numeric field. Reply To: Auto-incrementing numeric field.

  • Other than the suggestions in the topic you linked there is nothing new. There isn’t a way to create an auto-incrementing number fields without somehow storing the value of the last number created. As stated in the that other post, I would do this by having a WP options value to store this number. I would populate the field and increment that value.

    Another options would be to do this would be to query the _postmeta table directly to get the max value stored in the DB for that field.

    No matter what you do it will be prone to issues. For example, if you create two posts at the same time both could have the same number using either method. When using the options method you would have number skipped if you started creating a new post and updated the value before the post was saved and then decided not to save it.

    There really is no 100% reliable way of doing this. My suggestion would be to figure out why you need this and look for some other way do accomplish what you need.