Hey all!
I want to use a looper to show only specific posts that a user is allowed to see. I’d like to assign this access each time I make a post, so I have a couple options:
Option 1) Use an author/co-author/guest-author approach and simply add the user as an author. I imagine the code would look like this:
category_id=25&author={{dc:author:id}}
The problem I have with this method is that using a plugin like CO-AUTHORS PLUS or PUBLISHPRESS AUTHORS modifies a post’s author meta from a string into an array (I’m pretty sure anyways, didn’t actually check) which appears to cause reliability/compatibility problems using the above string for the looper provider.
Option 2) Use an ACF relational field (at the post, or possibly user level) to control what post gets attributed to which user. I’d like to test this option out rather than troubleshoot the other one… however, I’m unsure what the best approach might be in the looper provider settings. Consider that I need:
- Only show posts from 1 specific category, and
- Only show posts in that category that have been given a relationship (ACF) to the logged-in user, specifically.
What’s the best practice for achieving Option 2 above?
Also… which option sounds better in your opinion, or is there another way to achieve this that I’m not seeing (optional response to this question; here for curiosity’s and verification’s sake).