Query based on current username
-
Hello. First of all, thanks for the great plugin!
I’ve been trying to get this to work so that the current user info (user id or login name) would be passed on as a category to the query. I kind of got it to work but not really. I haven’t quite got the skills.
Something like, first query the current user:
$current_user = wp_get_current_user(); $got_login_name = $current_user->user_login;
Then result $got_login_name would be passed on as a category name to your query.
So “user1” would see posts categorized “user1”.
Or maybe there’s a much better way to get personalized posts listed per user, but this is as far I’ve got now. So the user is not the author here. They are simply posts that the admin has dedicated to this user. And categories seem to offer a simple and fast way to handle the dedication process. (I suppose the same could be done with a custom field too.)
- The topic ‘Query based on current username’ is closed to new replies.