When someone register to my site, they must fill this field (as user meta data) :

  • Name : A
  • Country: B
  • Region: C

so.. when I or other author was log in , I need a link that will display all post from the people who have same country & region with me .. how I can do that?

P.S : I build my registration form with "ultimate member" plug in


Unfortunately I don't have time to write the code, but here's what you need to do essentially:

  • Get the current author ID
  • Get the country-field for that user ID. Save this in a $variable.
  • In the loop, before the HTML output code, get the author ID and then get the country-field for that user ID. Store this in $variable2.
  • Then, wrap the HTML output code in an if-statement where you check if $variable === $variable2.

That is essentially how you do it. If no one else has later on, I will write some code for you, but right now I don't have time.

| improve this answer | |
  • @awangfaisal So do I need to write the code or not? – Athoxx Dec 20 '16 at 7:25

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.