Title: autoincrement
Last modified: December 15, 2023

---

# autoincrement

 *  Resolved [bertelu](https://wordpress.org/support/users/bertelu/)
 * (@bertelu)
 * [2 years, 5 months ago](https://wordpress.org/support/topic/autoincrement/)
 * Hi Folks, sorry i’m new on WP. i saw the solution for incrementing a fied ([Serial Number or Auto increment number field | WordPress.org](https://wordpress.org/support/topic/serial-number-or-auto-increment-number-field/))
   and i was implementing it succesfully, however i can’t figure out how can i set
   a starrting value other than 1. i need to start incrementing from a given value(
   i.e. 1254) and from there start incrementing. let say that i need to set an initial
   value of the variable when that variable is initialized for the first time
 * thanks for any help
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fautoincrement%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Plugin Support [Patrick – WPMU DEV Support](https://wordpress.org/support/users/wpmudevsupport12/)
 * (@wpmudevsupport12)
 * [2 years, 5 months ago](https://wordpress.org/support/topic/autoincrement/#post-17281978)
 * Hi [@bertelu](https://wordpress.org/support/users/bertelu/)
 * I hope you are doing well.
 * Based on that code it verifies if the incremental doesn’t exist yet it sets 1
 *     ```
       if ( ! $incremental ) {
       		$incremental = YOUR_NUMBER;
       	} else {
       		$incremental++;
       }
       ```
   
 * In this case, you should be able to replace 1 using any number.
 * Let us know if that was what you were looking for.
    Best Regards Patrick Freitas
 *  Thread Starter [bertelu](https://wordpress.org/support/users/bertelu/)
 * (@bertelu)
 * [2 years, 5 months ago](https://wordpress.org/support/topic/autoincrement/#post-17283526)
 * Thanks Patrick, i realized your solution rigth after submitting the topic. but
   now that my fariable has been already set (for the testing purpose) there is 
   a way to change the current value? let say that now the variable contain the 
   number “123” but now that i’m putting the site in production, i need to start
   from another value. how can i re-initialize the variable now that is already 
   existing?
 *  Plugin Support [Dmytro – WPMU DEV Support](https://wordpress.org/support/users/wpmudevsupport16/)
 * (@wpmudevsupport16)
 * [2 years, 5 months ago](https://wordpress.org/support/topic/autoincrement/#post-17284234)
 * Hello [@bertelu](https://wordpress.org/support/users/bertelu/),
 * You can temporarily replace this part:
 *     ```
       if ( ! $incremental ) {
       		$incremental = YOUR_NUMBER;
       	} else {
       		$incremental++;
       }
       ```
   
 * with:
 * `$incremental = YOUR_NUMBER;`
 * – change this to your desired current number, for example:
 * `$incremental = 0;`
 * Submit the form one time to reset the value. After submitting the form change
   the code back.
 * Hope this helps. Let us know if you have any questions.
 * Best Regards,
    Dmytro
 *  Plugin Support [Dmytro – WPMU DEV Support](https://wordpress.org/support/users/wpmudevsupport16/)
 * (@wpmudevsupport16)
 * [2 years, 5 months ago](https://wordpress.org/support/topic/autoincrement/#post-17299838)
 * Hello [@bertelu](https://wordpress.org/support/users/bertelu/),
 * We haven’t heard from you for a while, so I’m going to mark this thread as resolved.
 * Feel free to re-open it, in case you need any further help resolving the issue.
 * Best Regards,
    Dmytro

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘autoincrement’ is closed to new replies.

 * ![](https://ps.w.org/forminator/assets/icon-256x256.gif?rev=3443182)
 * [Forminator Forms – Contact Form, Payment Form & Custom Form Builder](https://wordpress.org/plugins/forminator/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/forminator/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/forminator/)
 * [Active Topics](https://wordpress.org/support/plugin/forminator/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/forminator/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/forminator/reviews/)

## Tags

 * [autoincrement](https://wordpress.org/support/topic-tag/autoincrement/)
 * [serial](https://wordpress.org/support/topic-tag/serial/)

 * 4 replies
 * 3 participants
 * Last reply from: [Dmytro – WPMU DEV Support](https://wordpress.org/support/users/wpmudevsupport16/)
 * Last activity: [2 years, 5 months ago](https://wordpress.org/support/topic/autoincrement/#post-17299838)
 * Status: resolved