Title: Wrong Project Id on Save
Last modified: August 22, 2016

---

# Wrong Project Id on Save

 *  Resolved [ravenjz](https://wordpress.org/support/users/ravenjz/)
 * (@ravenjz)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/wrong-project-id-on-save/)
 * As of 3.5.0 of optimizely the project id changes in the script tag when you save
   the configuration: [http://raventools.com/wp-admin/admin.php?page=optimizely-config](http://raventools.com/wp-admin/admin.php?page=optimizely-config).
   I removed the `absint()` function around the $project_id variable and it stopped
   creating the wrong id.:
 *     ```
       function optimizely_generate_script( $project_id ) {
       	return '<script src="//cdn.optimizely.com/js/' . $project_id . '.js"></script>';
       }
   
       // file optimizely/optimizely.php
       ```
   
 * – Jon Zumbrun
 * [https://wordpress.org/plugins/optimizely/](https://wordpress.org/plugins/optimizely/)

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

 *  [Daniel Iser](https://wordpress.org/support/users/danieliser/)
 * (@danieliser)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/wrong-project-id-on-save/#post-5889775)
 * [@ravenjz](https://wordpress.org/support/users/ravenjz/), [@arthuracs](https://wordpress.org/support/users/arthuracs/),
   [@bradtaylorsf](https://wordpress.org/support/users/bradtaylorsf/) – I ran into
   this also. Its because they use absint. absint() uses intval which has a maximum
   integer limit of `2147483647`. Meaning any number over that will return that 
   instead.
 * I fixed it by replacing it with
 *     ```
       function optimizely_generate_script( $project_id ) {
       	return '<script src="//cdn.optimizely.com/js/' . abs( floatval( $project_id ) ) . '.js"></script>';
       }
       ```
   
 * I see several other changes that can be made to prevent other issues, if you 
   guys wanna allow me committer access or give me an email I would be glad to send
   any recommended modifications to you.
 *  Plugin Author [bradtaylorsf](https://wordpress.org/support/users/bradtaylorsf/)
 * (@bradtaylorsf)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/wrong-project-id-on-save/#post-5889776)
 * [@danieliser](https://wordpress.org/support/users/danieliser/) [@ravenjz](https://wordpress.org/support/users/ravenjz/)
   thank you for the fix! I appreciate the help! If you see any other improvements
   you can visit our open source git repo and do a pull request. You can find the
   git repo here: [https://github.com/optimizely/wordpress-plugin](https://github.com/optimizely/wordpress-plugin)
 * I have updated the plugin to version 3.5.1 to address this issue.
 * Thanks again!
 *  [Daniel Iser](https://wordpress.org/support/users/danieliser/)
 * (@danieliser)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/wrong-project-id-on-save/#post-5889777)
 * [@bradtaylorsf](https://wordpress.org/support/users/bradtaylorsf/) – Awesome,
   will submit a few PRs for some other small things I ran into. This one was the
   biggest issue by far since optimizely ids are now larger than intval can support.
 *  [Daniel Iser](https://wordpress.org/support/users/danieliser/)
 * (@danieliser)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/wrong-project-id-on-save/#post-5889778)
 * [@bradtaylorsf](https://wordpress.org/support/users/bradtaylorsf/) – did you 
   see this one while your at it? [https://wordpress.org/support/topic/powered-testing-input-limits-2-digits?replies=2](https://wordpress.org/support/topic/powered-testing-input-limits-2-digits?replies=2)

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

The topic ‘Wrong Project Id on Save’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/optimizely_004a69.svg)
 * [Optimizely Classic](https://wordpress.org/plugins/optimizely/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/optimizely/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/optimizely/)
 * [Active Topics](https://wordpress.org/support/plugin/optimizely/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/optimizely/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/optimizely/reviews/)

 * 4 replies
 * 3 participants
 * Last reply from: [Daniel Iser](https://wordpress.org/support/users/danieliser/)
 * Last activity: [11 years, 1 month ago](https://wordpress.org/support/topic/wrong-project-id-on-save/#post-5889778)
 * Status: resolved