Skip to main content
Improve The Question
Source Link
Trello
  • 111
  • 3
  • 13

Get meta_query value by arrayuser meta array

This is my code:

$type = "pictures";
$args['orderby'] = "post_modified";
$args['order'] = "DESC";
$args['post_type'] = $type;
$args['post_status'] = "publish";
$args['meta_query'] = array(
    array (
        'key' => 'picture_liked_users',
        'value' => array(get_user_meta($user->ID, 'following_users', true)),
        'compare' => 'LIKE'
    ),
);

I need to get the pictures that liked by users that iI follow.

This is an example of how following_users meta is storestored in the database:

a:1:{i:0;s:2:"87";}

So iI try to get the user meta following_user by using an array but iI failed it's giveit gives me a PHP error and also try extract PHP function but also failed.

AnyCan anyone help me?

Get meta_query value by array meta

This is my code:

$type = "pictures";
$args['orderby'] = "post_modified";
$args['order'] = "DESC";
$args['post_type'] = $type;
$args['post_status'] = "publish";
$args['meta_query'] = array(
    array (
        'key' => 'picture_liked_users',
        'value' => array(get_user_meta($user->ID, 'following_users', true)),
        'compare' => 'LIKE'
    ),
);

I need to get the pictures that liked by users that i follow.

This is example of how following_users meta is store in the database:

a:1:{i:0;s:2:"87";}

So i try to get the user meta following_user by using array but i failed it's give me a PHP error and also try extract PHP function but also failed.

Any help?

Get meta_query value by user meta array

This is my code:

$type = "pictures";
$args['orderby'] = "post_modified";
$args['order'] = "DESC";
$args['post_type'] = $type;
$args['post_status'] = "publish";
$args['meta_query'] = array(
    array (
        'key' => 'picture_liked_users',
        'value' => array(get_user_meta($user->ID, 'following_users', true)),
        'compare' => 'LIKE'
    ),
);

I need to get the pictures that liked by users that I follow.

This is an example of how following_users meta is stored in the database:

a:1:{i:0;s:2:"87";}

So I try to get the user meta following_user by using an array but I failed it gives me a PHP error and also try extract PHP function but also failed.

Can anyone help me?

Source Link
Trello
  • 111
  • 3
  • 13

Get meta_query value by array meta

This is my code:

$type = "pictures";
$args['orderby'] = "post_modified";
$args['order'] = "DESC";
$args['post_type'] = $type;
$args['post_status'] = "publish";
$args['meta_query'] = array(
    array (
        'key' => 'picture_liked_users',
        'value' => array(get_user_meta($user->ID, 'following_users', true)),
        'compare' => 'LIKE'
    ),
);

I need to get the pictures that liked by users that i follow.

This is example of how following_users meta is store in the database:

a:1:{i:0;s:2:"87";}

So i try to get the user meta following_user by using array but i failed it's give me a PHP error and also try extract PHP function but also failed.

Any help?