wp_set_object_terms not accepting variable array

Ok, so it turned out that my array was an array of strings somehow, which using var_dump (instead of print_r) revealed. Then I needed to convert my array to int values, which I did thus: $myissuearrayINT = array_map(‘intval’, $myissuearray); And now, when I do the following it works as expected: wp_set_object_terms( $myID, $myissuearrayINT, ‘my_issues’, true … Read more

How can get all users by current user meta (array)?

This a:1:{i:0;s:1:”3″;} is the serialized version of an array in PHP. You can unserialize it by using the function unserialize like below- $data = unserialize(‘a:1:{i:0;s:1:”3″;}’); So after unserialize inside $data you’ll get an array like below- Array ( [0] => 3 ) This array will contain the user ID which is blocked by the user … Read more

Related Post by Tags Code

So, if I’m reading your code correctly, you are trying to dump all the current posts’ tag IDs into your tag__in array. My only hesitation is I’m not sure exactly how the query returns the order, if it’s just done by post date or actual tag relevance. That should look something like this: if ( … Read more

How to send json data to jquery

You could use one of these. It would give you json data. $data = json_encode( array(‘status’ => 200, ‘message’ => ‘success’); $result = wp_send_json_success( array( ‘photo_id’ => $photo_id_encode,’upload_msg’ => ‘Success’ ) );

How to set an array of current usernames

So right now you have this if ($user && isset($user->user_login) && ‘username’ == $user->user_login ) { To check for one specific user. If you want to check against multiple usernames, PHP’s function in_array() comes in handy $allowed = array( ‘user1’, ‘user2’, ); if ($user && isset($user->user_login) && in_array($user->user_login, $allowed) ) {

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)