Restrict Categories
Restricting categories for users programmatically (2 posts)

  1. acoelhosantos
    Posted 4 years ago #

    Let me start by saying good job in this plugin. For me, it works perfectly and I have no problems with it.

    I was now wondering if besides the normal admin page, if there is a defined way for restricting categories through php code (programmatically). My intent is to automatically restrict categories when a user registers in the site.

    Thanking you in advance for any help.


  2. valuser
    Posted 4 years ago #

    Would playing around with this be of any help

    function onlyinclude_tag($query) {
    if ( $query->is_home() && is_user_logged_in()) {
    	$query-> set('category__in',array('green'));
    return $query;

    Change the if conditions and the category (green) to suit you

    and place function in the functions.php of your theme

    see also http://codex.wordpress.org/Class_Reference/WP_Query

    May help

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Restrict Categories
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic