Add recursive post meta function
This commit is contained in:
@@ -1095,9 +1095,8 @@ if ( !function_exists( 'sp_update_post_meta' ) ) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !function_exists( 'sp_update_post_meta_recursive' ) ) {
|
if ( !function_exists( 'sp_add_post_meta_recursive' ) ) {
|
||||||
function sp_update_post_meta_recursive( $post_id, $meta_key, $meta_value ) {
|
function sp_add_post_meta_recursive( $post_id, $meta_key, $meta_value ) {
|
||||||
delete_post_meta( $post_id, $meta_key );
|
|
||||||
$values = new RecursiveIteratorIterator( new RecursiveArrayIterator( $meta_value ) );
|
$values = new RecursiveIteratorIterator( new RecursiveArrayIterator( $meta_value ) );
|
||||||
foreach ( $values as $value ):
|
foreach ( $values as $value ):
|
||||||
add_post_meta( $post_id, $meta_key, $value, false );
|
add_post_meta( $post_id, $meta_key, $value, false );
|
||||||
@@ -1105,6 +1104,13 @@ if ( !function_exists( 'sp_update_post_meta_recursive' ) ) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( !function_exists( 'sp_update_post_meta_recursive' ) ) {
|
||||||
|
function sp_update_post_meta_recursive( $post_id, $meta_key, $meta_value ) {
|
||||||
|
delete_post_meta( $post_id, $meta_key );
|
||||||
|
sp_add_post_meta_recursive( $post_id, $meta_key, $meta_value );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ( !function_exists( 'sp_update_user_meta_recursive' ) ) {
|
if ( !function_exists( 'sp_update_user_meta_recursive' ) ) {
|
||||||
function sp_update_user_meta_recursive( $user_id, $meta_key, $meta_value ) {
|
function sp_update_user_meta_recursive( $user_id, $meta_key, $meta_value ) {
|
||||||
delete_user_meta( $user_id, $meta_key );
|
delete_user_meta( $user_id, $meta_key );
|
||||||
|
|||||||
Reference in New Issue
Block a user