Skip to content

Instantly share code, notes, and snippets.

Created May 19, 2017
What would you like to do?
Pros/Cons of absint()

absint() - WordPress attempt at standardization?

absint() is a WordPress function that passes a string through abs() to turn any negative number into a positive and then intval() which will typecast it as an integer with the above listed “cons” for (int)/inval().


  1. Currently there is no way to filter the results before passing the value to the function that queries the database
  2. Does not check for or return a falsey response in case of a malformed ID being passed.
  3. See list for (int)/intval()*


  1. Can be passed as a parameter to functions that can accept functions as a parameter such as array_map()
  2. Can be altered as a part of core and not a language defined function.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment