• Resolved flexinoodle

    (@flexinoodle)


    I have custom posts with custom taxonomy, these are in their own menu in the wp admin pages, i can click on taxonomy settings, show hierachiacel taxonmy, add my custom taxonomy, but when i then click on go to tag groups page, it says sorry, you are not allowed to access this page ?
    Any ideas, because i obviously cant buy premium until make sure this works, it is exactly what i need.

    The page I need help with: [log in to see the link]

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter flexinoodle

    (@flexinoodle)

    <?php
     /**
     * Plugin Name: dbposts
     * Plugin URI: https://5pin.link
     * Description: Custom Post Types.
     * Version: 1.0
     * Author: 5pin.link
     * Author URI: https://5pin.link
     */
    add_action( 'admin_menu', 'my_admin_menu' );
    
    //Add top level admin page - not required if youve already added it
    function my_admin_menu() {
    add_menu_page( 'Database', 'Database', 'manage_options', 'item_database', 'admin_page', 'dashicons-format-audio', 5 );
    }
    
    //add submenu page to link to db item types
    add_action('admin_menu', 'myy_admin_menu');
    function myy_admin_menu() {
    add_submenu_page('item_database', 'DB Item Types', 'DB Item Types', 'manage_options', 'edit-tags.php?taxonomy=dbtypes');
    }
    
    function admin_page(){
    ?>
    <div class="wrap">
    <h2>Welcome To My Plugin</h2>
    <p>Puts Lots Of Stuff Here</p>
    </div>
    <?php
    }
    
    // Creates Database Entry
    function iosaufx_init() {
    $args = array(
    'label' => 'IOS AUfx',
    'public' => true,
    'show_ui' => true,
    'capability_type' => 'post',
    'hierarchical' => true,
    'rewrite' => array('slug' => 'iosaufx'),
    'query_var' => true,
    'show_in_menu' => 'item_database',
    'show_in_rest' => true,
    'exclude_from_search' => false,
    'publicly_queryable' => true,
    'taxonomies' => array( 'dbtypes' ),
    'supports' => array(
    'title',
    'editor',
    'excerpt',
    'trackbacks',
    'custom-fields',
    'comments',
    'revisions',
    'thumbnail',
    'author',
    'page-attributes',)
    );
    register_post_type( 'iosaufx', $args );
    }
    add_action( 'init', 'iosaufx_init' );
    
    //hook into the init action and call create_book_taxonomies when it fires
    add_action( 'init', 'create_dbitems_hierarchical_taxonomy', 0 );
    
    // Creates Database Entry
    function iosaui_init() {
    $args = array(
    'label' => 'IOS AUi',
    'public' => true,
    'show_ui' => true,
    'capability_type' => 'post',
    'hierarchical' => true,
    'rewrite' => array('slug' => 'iosaui'),
    'query_var' => true,
    'show_in_menu' => 'item_database',
    'show_in_rest' => true,
    'exclude_from_search' => false,
    'publicly_queryable' => true,
    'taxonomies' => array( 'dbtypes' ),
    'supports' => array(
    'title',
    'editor',
    'excerpt',
    'trackbacks',
    'custom-fields',
    'comments',
    'revisions',
    'thumbnail',
    'author',
    'page-attributes',)
    );
    register_post_type( 'iosaui', $args );
    }
    add_action( 'init', 'iosaui_init' );
    
    //hook into the init action and call create_book_taxonomies when it fires
    add_action( 'init', 'create_dbitems_hierarchical_taxonomy', 0 );
    
    // Creates Database Entry
    function iosdaw_init() {
    $args = array(
    'label' => 'IOS DAW',
    'public' => true,
    'show_ui' => true,
    'capability_type' => 'post',
    'hierarchical' => true,
    'rewrite' => array('slug' => 'iosdaw'),
    'query_var' => true,
    'show_in_menu' => 'item_database',
    'show_in_rest' => true,
    'exclude_from_search' => false,
    'publicly_queryable' => true,
    'taxonomies' => array( 'dbtypes' ),
    'supports' => array(
    'title',
    'editor',
    'excerpt',
    'trackbacks',
    'custom-fields',
    'comments',
    'revisions',
    'thumbnail',
    'author',
    'page-attributes',)
    );
    register_post_type( 'iosdaw', $args );
    }
    add_action( 'init', 'iosdaw_init' );
    
    //hook into the init action and call create_book_taxonomies when it fires
    add_action( 'init', 'create_dbitems_hierarchical_taxonomy', 0 );
    
    // Creates Database Entry
    function iosgb_init() {
    $args = array(
    'label' => 'IOS Groovebox',
    'public' => true,
    'show_ui' => true,
    'capability_type' => 'post',
    'hierarchical' => true,
    'rewrite' => array('slug' => 'iosgroovebox'),
    'query_var' => true,
    'show_in_menu' => 'item_database',
    'show_in_rest' => true,
    'exclude_from_search' => false,
    'publicly_queryable' => true,
    'taxonomies' => array( 'dbtypes' ),
    'supports' => array(
    'title',
    'editor',
    'excerpt',
    'trackbacks',
    'custom-fields',
    'comments',
    'revisions',
    'thumbnail',
    'author',
    'page-attributes',)
    );
    register_post_type( 'iosgb', $args );
    }
    add_action( 'init', 'iosgb_init' );
    
    //hook into the init action and call create_book_taxonomies when it fires
    add_action( 'init', 'create_dbitems_hierarchical_taxonomy', 0 );
    
    // Creates Database Entry
    function iosdjs_init() {
    $args = array(
    'label' => 'IOS DJ Software',
    'public' => true,
    'show_ui' => true,
    'capability_type' => 'post',
    'hierarchical' => true,
    'rewrite' => array('slug' => 'iosdjs'),
    'query_var' => true,
    'show_in_menu' => 'item_database',
    'show_in_rest' => true,
    'exclude_from_search' => false,
    'publicly_queryable' => true,
    'taxonomies' => array( 'dbtypes' ),
    'supports' => array(
    'title',
    'editor',
    'excerpt',
    'trackbacks',
    'custom-fields',
    'comments',
    'revisions',
    'thumbnail',
    'author',
    'page-attributes',)
    );
    register_post_type( 'iosdjs', $args );
    }
    add_action( 'init', 'iosdjs_init' );
    
    //hook into the init action and call create_book_taxonomies when it fires
    add_action( 'init', 'create_dbitems_hierarchical_taxonomy', 0 );
    
    // Creates Database Entry
    function iosloop_init() {
    $args = array(
    'label' => 'IOS Looper',
    'public' => true,
    'show_ui' => true,
    'capability_type' => 'post',
    'hierarchical' => true,
    'rewrite' => array('slug' => 'ioslooper'),
    'query_var' => true,
    'show_in_menu' => 'item_database',
    'show_in_rest' => true,
    'exclude_from_search' => false,
    'publicly_queryable' => true,
    'taxonomies' => array( 'dbtypes' ),
    'supports' => array(
    'title',
    'editor',
    'excerpt',
    'trackbacks',
    'custom-fields',
    'comments',
    'revisions',
    'thumbnail',
    'author',
    'page-attributes',)
    );
    register_post_type( 'iosloop', $args );
    }
    add_action( 'init', 'iosloop_init' );
    
    //hook into the init action and call create_book_taxonomies when it fires
    add_action( 'init', 'create_dbitems_hierarchical_taxonomy', 0 );
    
    // Creates Database Entry
    function iosother_init() {
    $args = array(
    'label' => 'IOS Other',
    'public' => true,
    'show_ui' => true,
    'capability_type' => 'post',
    'hierarchical' => true,
    'rewrite' => array('slug' => 'iosother'),
    'query_var' => true,
    'show_in_menu' => 'item_database',
    'show_in_rest' => true,
    'exclude_from_search' => false,
    'publicly_queryable' => true,
    'taxonomies' => array( 'dbtypes' ),
    'supports' => array(
    'title',
    'editor',
    'excerpt',
    'trackbacks',
    'custom-fields',
    'comments',
    'revisions',
    'thumbnail',
    'author',
    'page-attributes',)
    );
    register_post_type( 'iosother', $args );
    }
    add_action( 'init', 'iosother_init' );
    
    //hook into the init action and call create_book_taxonomies when it fires
    add_action( 'init', 'create_dbitems_hierarchical_taxonomy', 0 );
    
    // Creates Database Entry
    function android_init() {
    $args = array(
    'label' => 'Android',
    'public' => true,
    'show_ui' => true,
    'capability_type' => 'post',
    'hierarchical' => true,
    'rewrite' => array('slug' => 'android'),
    'query_var' => true,
    'show_in_menu' => 'item_database',
    'show_in_rest' => true,
    'exclude_from_search' => false,
    'publicly_queryable' => true,
    'taxonomies' => array( 'dbtypes' ),
    'supports' => array(
    'title',
    'editor',
    'excerpt',
    'trackbacks',
    'custom-fields',
    'comments',
    'revisions',
    'thumbnail',
    'author',
    'page-attributes',)
    );
    register_post_type( 'android', $args );
    }
    add_action( 'init', 'android_init' );
    
    //hook into the init action and call create_book_taxonomies when it fires
    add_action( 'init', 'create_dbitems_hierarchical_taxonomy', 0 );
    
    //create a custom taxonomy name it topics for your posts
    function create_dbitems_hierarchical_taxonomy() {
    
    // Add new taxonomy, make it hierarchical like categories
    //first do the translations part for GUI
    
    $labels = array(
    'name' => _x( 'DB Item Types', 'taxonomy general name' ),
    'singular_name' => _x( 'DB Item Type', 'taxonomy singular name' ),
    'search_items' => __( 'Search DB Types' ),
    'all_items' => __( 'All DB Types' ),
    'parent_item' => __( 'Parent DB Item Type' ),
    'parent_item_colon' => __( 'Parent DB Item Type:' ),
    'edit_item' => __( 'Edit DB Item Type' ),
    'update_item' => __( 'Update DB Item Type' ),
    'add_new_item' => __( 'Add New DB Item Type' ),
    'new_item_name' => __( 'New DB Type Name' ),
    //'menu_name' => __( 'DB Item Types' ),
    );
    
    // Now register the taxonomy
    
    register_taxonomy('dbtypes',array(
    'iosaufx', 
    'iosaui' , 
    'iosdaw' , 
    'iosgb' , 
    'iosdjs' , 
    'iosloop' ,
    'iosother' ,
    'android' 
    ), 
     array(
    'hierarchical' => true,
    'labels' => $labels,
    'show_ui' => true,
    'show_in_rest' => true,
    'show_admin_column' => true,
    'query_var' => true,
    'rewrite' => array( 'slug' => 'dbtypes' ),
    ));
    
    }

    That is my custom plugin for my own custom post types and taxonomies, that are in their own menu.
    Which looks like this in the admin pages….
    https://5pin.link/screengrabs/IOS_AUi__5pin.link__WordPress_2018-11-05_10-11-46.png

    Hopefully that is enough info, let me know, really liking the look of the premium with the two level tag listing, i have been trying to find something that did three levels, but two will be better than nothing ??
    Really fancy shuffle box.

    Christoph

    (@camthor)

    The Tag Groups (Premium) plugins support only non-hierarchical taxonomies, such as tags. The settings allow to activate hierarchical taxonomies (such as categories) but that is only for users who feel adventurous. That means some features may work, but others (like Meta Box and possibly more) won’t. So you could first check if your project can be reorganized so that you use non-hierarchical taxonomies with this plugin.

    Under the post type of the selected taxonomy should be a new submenu called “Tag Groups”. (And it should also appear for hierarchical taxonomies.) I cannot see it on your screenshot, so somehow it was not correctly registered, which explains the error message.

    The new submenu should be hooked into the menu with the URL
    .../wp-admin/edit.php?post_type=iosaufx (Can you confirm that this URL works?)
    and the URL of the tag groups page should be:
    .../wp-admin/edit.php?post_type=iosaufx&page=tag-groups_iosaufx

    You could try other parameters for register_taxonomy (capabilities, show_in_menu, …) if that makes a difference.

    Then you could try one of other WP plugins that create custom post types and taxonomies. If they work, then something must be different in way how you declare them in your plugin. Usually it works and I confirmed it now with WooCommerce and product categories.

    Lastly, you could select another taxonomy just to make sure that the tag groups page appears under the corresponding post type and nothing else is interfering.

    Thread Starter flexinoodle

    (@flexinoodle)

    Yes it works with standard post tags, so it is my custom posts its not working with, FYI im a complete newb at all this stuff, i made my plugin from googling etc.
    I shall try and work out how to do non hierachical and get back to you.

    Thread Starter flexinoodle

    (@flexinoodle)

    …/wp-admin/edit.php?post_type=iosaufx
    This works.
    …/wp-admin/edit.php?post_type=iosaufx&page=tag-groups_iosaufx
    This gives the error as above, sorry you are not allowed access to this page.

    Thread Starter flexinoodle

    (@flexinoodle)

    I created a tag group, added tags to it, added those tags to normal posts, does nothing, i can show the tags using a shortcode, click on one and it just says..Nothing was found at this location. Try searching, or check out the links below.
    Gonna check the forum, are there any sites that actually shows that this plugin works ?

    Thread Starter flexinoodle

    (@flexinoodle)

    OK nevermind, i have been informed this plugin doesnt work at all with custom posts, have tried a few ways to create custom posts, non work, thanks anyway.

    Christoph

    (@camthor)

    This plugin works with custom posts, for example with WooCommerce products. Self-built plugins can however be a problem.

    If your tag groups don’t show the tags, then the parameters are probably wrong. (wrong taxonomy or whether to show empty tags).

    Thread Starter flexinoodle

    (@flexinoodle)

    A bunch of people have checked this now, it doesnt work with custom posts and taxonomies

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Sorry, you are not allowed to access this page’ is closed to new replies.