Using ACF default value to autoincrement a number field

Not a direct answer, but two suggestions.

First of all, get_last_numero does not necessarily return the highest number. It returns the last one. If you have full control over insertion then it will be no problem, but once you will do an import, or change things in the database manually or in other ways than the usual, you might introduce problems. So, in your get_last_numero function, you might want to sort on that (meta) query value DESC. ACF has a function for meta queries to sort numerically.

Second, get_last_numero() + 1 might seem to work, but you’re adding a string and a number, which is not a good thing to do. PHP will figure it out in most cases, but since ACF will return a string for a field and you know that, you could cast your return value to integer by preceding the value with (int), so return (int)$numero

tech