WordPress.org

Ready to get started?Download WordPress

Forums

Restrict Categories
[resolved] Custom Taxonomies not loading due to plugin (3 posts)

  1. keendev
    Member
    Posted 1 year ago #

    Hi,

    I have a custom taxonomy, and it seems as though this plugin is preventing me from seeing all of my items inside the edit custom post type page. E.g. when i disable this plugin i can see all taxonomy terms correctly.

    I went into the code found (Line 39):
    if ( $post_type == false || $post_type == 'post' )

    and replaced it with:

    if ($post_type == 'post' )

    I can now see my custom taxonomy terms on the edit custom post type item page. Is there a reason for this?

    Thanks

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

  2. keendev
    Member
    Posted 1 year ago #

    However this has disabled it sitewide. Upon further investigation.

    Now if is visit:

    post-new.php

    it will not run the plugin at all, since post_type is not set. Though if i do:

    post-new.php?post_type=post, it works as expected and blogs out categories.

    I tried to get it to check if the currently edited post is a post type other then 'post' however the global $post variable is not available at init.

    So it seems as though the issue stands on post-new.php & for custom taxonomies.

    Regards

  3. keendev
    Member
    Posted 1 year ago #

    Hi guys,

    I have seemed to fix the issue please do the following and let me know if it works for you.

    I believe the issue stems from the following:

    If you delete a category it remains in the cached options of categories a user can post to. Now since Restrict Categories will loop through all these categories and try find the ID a deleted category will return no id cause the query to mess up. This could be something inside 3.5 causing the issue.

    So do the following:

    Find:
    $this->cat_list .= $term_id . ',';

    Above Add:
    if ( !empty( $term_id ) )

    You will need to perform this twice. The lines associated with these edits is 461 and 484.

    Please let me know what happens :)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic