{"id":9521460,"date":"2017-09-22T16:19:47","date_gmt":"2017-09-22T16:19:47","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/creating-permalink-for-users-favorite-posts\/"},"modified":"2017-09-22T16:25:58","modified_gmt":"2017-09-22T16:25:58","slug":"creating-permalink-for-users-favorite-posts","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/creating-permalink-for-users-favorite-posts\/","title":{"rendered":"Creating permalink for user&#8217;s favorite posts"},"content":{"rendered":"<p>I would like for all users to add favorites and then share them with a link.<\/p>\n<p>Is there a way to create a permalink or a URL structure that would allow anyone to visit a page displaying any users favorited posts, including anonymous users? I am using cookies only to store the data since creating an account is not in scope.<\/p>\n<p>I see that I can get user favorites with <code>get_user_favorites_list();<\/code> but I don&#8217;t believe I will not have a user ID stored to enter into that function (Assuming that I can read an ID from a URL query string).<\/p>\n<p>I have a page that lists the current user&#8217;s favorited posts like so: (I am working locally so no link right now. Sorry!)<\/p>\n<pre><code>while ( have_posts() ) : the_post();\n    $favorites = get_user_favorites();\n    if ( $favorites ){\n        foreach($favorites as $post_id) {\n        ...markup...\n        }\n        ...<\/code><\/pre>\n<p>Thanks for your help!<\/p>\n","protected":false},"template":"","class_list":["post-9521460","topic","type-topic","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/9521460","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":3,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/9521460\/revisions"}],"predecessor-version":[{"id":9521467,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/9521460\/revisions\/9521467"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=9521460"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}