Support » Plugins » Fix for "Restrict Categories" Plugin and custom taxonomies

  • Resolved Ov3rfly

    (@ov3rfly)


    If “Restrict Categories” plugin is installed and custom taxonomies are used and attached to your posts, then the metabox of the taxonomy will show up empty because its IDs are filtered by the plugin (which should only filter categories).

    Fix, change the plugin-code to this:

    /**
     * Explicitly remove extra categories from view that user can manage
     * Will affect Category management page, Posts dropdown filter, and New/Edit post category list
     *
     * @since 1.3
     * @global $cat_list string The global comma-separated list of restricted categories.
     * @return $excluded string Appended clause on WHERE of get_taxonomy // FIX: no, it's get_terms!
     */
    public function exclusions(){
    	// $excluded = ' AND t.term_id IN (' . $this->cat_list . ')';	// OLD
    	$excluded = ' AND ( t.term_id IN (' . $this->cat_list . ') OR tt.taxonomy NOT IN (\'category\') )';
    
    	return $excluded;
    }

    http://wordpress.org/extend/plugins/restrict-categories/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Again, thanks for the contribution. I will look into this more thoroughly soon.

    Thanks. Here a testcase for the current version:

    1. With “Custom Post Types UI” plugin, create a custom taxonomy e.g. “MyTax”, attach to “post” and set “hierarchical” to “True” (in “Advanced Options”).

    2. Then you should have a “MyTax” menu entry at “Posts” in admin backend. Add some entries.

    3. Write/edit a “post” with an account/role which has restriced categories and find the “MyTax” metabox on write/edit screen empty.

    4. Remove restriction or disable “Restrict categories” plugin and find the “MyTax” metabox on write/edit screen populated with your entries.

    Resolved, fix is included in Version 2.3

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Fix for "Restrict Categories" Plugin and custom taxonomies’ is closed to new replies.