I am soo new to Wordpress development, so I am so lost in this.

I have a custom post type "Like" that automatically adds the post_id of the page/post the user liked, and the "Like" post type contains only the post_id, nothing else.

So, my "Post" and "Like" has one common denominator which is the "Post" post_id.

I want to list/retrieve all the posts liked by the current user in a different page and the only code I can get in mind is this;

    'post_type' => 'like',
    'author' => get_current_user_id(),
    'meta_query'=> array(
        'key' => 'liked_post_id',
        'compare' => '=',
        'value' => get_the_ID() // this returns the ID of the page/post the user liked



I hope someone can help me with this. :)

Your Answer

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

Browse other questions tagged or ask your own question.