I have a custom meta "code" in my CPT. How can I make it so that it has a number that will auto increment every time the admin publishes a post?
My solution is to add a table in the database that is "code". Every time the user publishes a post, it will add 1 to the code table. Then I will use a script to append the code from the db to the meta. But it does not seem to add in the db.
Please present alternative/better solutions.