Title: array_slice
Last modified: August 20, 2016

---

# array_slice

 *  [yeagerc50](https://wordpress.org/support/users/yeagerc50/)
 * (@yeagerc50)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/array_slice/)
 * ok, this little piece of code used to work nicely to trim “submit” from my $_POST
   array like so:
    //removes “submit” from $_POST $slice = (array_slice($_POST,0,12));
 * Since I added it to my program in WP it stopped doing it’s job.
    Is there a way
   to prevent it from showing up in $_POST?

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

 *  [michael.mariart](https://wordpress.org/support/users/michaelmariart/)
 * (@michaelmariart)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/array_slice/#post-2954028)
 * Do you have exactly 13 fields in your $_POST arrya, and is the last one the submit?
   If so, then it will still work. if not, then it’s never going to do what you 
   expect.
 * It doesn’t matter if the submit is there or not. If you don’t do anything with
   it, then it’s really more work get rid of it then it is to leave it there and
   just ignore it.
 * If you want to get rid of it, you’ll need to know the name that it’s submitted
   under. Most are just ‘submit”, but it will depend on what your buttons name=””
   value is set as. You would just use this:
 * `unset ($_POST['submit'])`
 * That’s all there is to it. That will remove that entry form the $_POST array.
 * But remember… Just removing it from the $_POST array won’t remove it from $_REQUEST
   as well.
 *  Thread Starter [yeagerc50](https://wordpress.org/support/users/yeagerc50/)
 * (@yeagerc50)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/array_slice/#post-2954082)
 * Sweet ….. works like a charm!
 * btw, if I leave it in $_POST, $wpdb->insert() pukes because I don’t
    have a column
   for ‘submit’ in my db. Why bother storing something if you don’t need it.
 * Thanks again!

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

The topic ‘array_slice’ is closed to new replies.

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 2 replies
 * 2 participants
 * Last reply from: [yeagerc50](https://wordpress.org/support/users/yeagerc50/)
 * Last activity: [13 years, 10 months ago](https://wordpress.org/support/topic/array_slice/#post-2954082)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
