Created
June 19, 2018 21:17
-
-
Save m-e-h/81b0c90e5a3cedf11f57c7703ef193bb to your computer and use it in GitHub Desktop.
Gravity forms field array/string to array
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$string = $gv_entry->entry['30']; | |
// Remove brackets. | |
$string = trim( $string, '[]' ); | |
$post_ids = array_map( | |
function( $string_id ) { | |
// Remove quotes around IDs. | |
return trim( $string_id, '"' ); | |
}, | |
explode( ',', $string ) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment