WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Fix for "Restrict Categories" Plugin and custom taxonomies (4 posts)

  1. Ov3rfly
    Member
    Posted 2 years ago #

    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/

  2. Again, thanks for the contribution. I will look into this more thoroughly soon.

  3. Ov3rfly
    Member
    Posted 2 years ago #

    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.

  4. Ov3rfly
    Member
    Posted 2 years ago #

    Resolved, fix is included in Version 2.3

Topic Closed

This topic has been closed to new replies.

About this Topic