0

I have a user meta key prize which is an array contains prize type and prize date. The date in unix timestamp. How I can delete the user meta by specify the prize date only?

Example code:

delete_user_meta( $userID, 'prize', $meta_value ); 
$meta_value = array(
    'prize' => array(
         // Add something here like prize date = 1506556467
    ) , 
);

Key value in the database look like this:

a:2:{i:0;s:17:"prize name";i:1;i:1506556467;}

And what if I want to delete the metakeys if the value in between 2 integer like 1506550000 and 1506550001 for example.

0

The $meta_value is optional and I you will be having a unique entry of prize for each user so you can just use the function without $meta_value.

delete_user_meta( $userID, 'prize' ); 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.