We are using custom code (or will be) to detect user groups from our forums to determine whether or not a post's content will be displayed. So if you are someone who has over 500 posts, you are placed into a certain user group via the forum software and can view certain articles on our front page. So the code we will be putting into Wordpress will be something like this: “If in X forum user group, show this; if not, show this message."

My question is, where do we apply the coding for that across Wordpress? For example we have single.php which shows the news story pages, loop.php which shows the stories in the archives and search, etc. But is there a higher level to apply that code to insure that the news story content visibility is restricted in every possible place? For example, would we have to apply that code individually to the RSS feed too, or is there just one go-to place on a higher level to do it?

Thank you so much! This place is such an invaluable resource.

  • Where do you store the user groups reading capabilities? – gmazzap Aug 27 '13 at 4:32

you can place your function in functions.php and attach an action hook . which will decide when to call your function. If you only want to hide content of the posts you can use this hook

 add_action('the_content', 'yourcustomfunction')

or i would suggest this hook which will be called before your actually post query is run .

add_action('pre_get_posts', 'yourcustomfunction') 

function yourcustomfunction () {

place this in your theme's functions.php .

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.