Last active
February 9, 2022 18:52
-
-
Save fgrweb/be069e8a477170eb9f8621e6c5081182 to your computer and use it in GitHub Desktop.
Grabar de manera serializada un array en un post meta de WordPress, "limpiando" primero las comillas simples del 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
function stripslashes_deep( $value ) { | |
$value = is_array( $value ) ? array_map( 'stripslashes_deep', $value ) : stripslashes( $value ); | |
return $value; | |
} | |
function fgr_grabar_meta( $post_id, $array_data ) { | |
$new_data = maybe_serialize( stripslashes_deep( $array_sata ) ); | |
update_post_meta( $post_id, 'fgr_meta', $new_data ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment