0

The editor role is able to open following URL:

https://example.com/wp-admin/edit.php?booking-status=booked&post_type=booking

But not able to open following URL:

https://example.com/wp-admin/edit.php?post_type=booking

I am facing this amazing problem as when I pass other parameters with post_type then it is opening custom post type edit screen but when I only pass post_type then it is not opening.

This is only happening with editor role.

<?php

function create_booking_post_type() {

    $labels = array(
        'name' => __( 'Bookings','framework'),
        'singular_name' => __( 'booking','framework' ),
        'add_new' => __('Add New','framework'),
        'add_new_item' => __('Add New booking','framework'),
        'edit_item' => __('Edit booking','framework'),
        'new_item' => __('New booking','framework'),
        'view_item' => __('View booking','framework'),
        'search_items' => __('Search booking','framework'),
        'not_found' =>  __('No booking found','framework'),
        'not_found_in_trash' => __('No booking found in Trash','framework'),
        'parent_item_colon' => ''
    );

    $args = array(
        'labels' => $labels,
        'public' => true,
        'publicly_queryable' => true,
        'show_ui' => true,
        'query_var' => true,
        'has_archive' => true,
        'capability_type' => 'post',
        'hierarchical' => true,
        'menu_position' => 5,
        'supports' => array(
        'title','editor','thumbnail','revisions','author','page-attributes'),
        'rewrite' => array( 'slug' => __('booking', 'framework') )
    );

    register_post_type('booking',$args);
}
  • Please show us the code creating the custom post type. – Max Yudin Aug 17 '16 at 9:40
  • @MaxYudin, here is code: textuploader.com/58c9d – user1719322 Aug 17 '16 at 10:12
  • Can not reproduce the problem. Do you use any user roles managing plugins or custom code? Also, where do you get booking-status=booked query in the URL? – Max Yudin Aug 17 '16 at 10:54
  • @MaxYudin, additionally I have created custom taxonomies like booking-status, booking-types, booking-features etc. I am using user role editor plugin. – user1719322 Aug 17 '16 at 11:13
  • So, please edit your question adding necessary information including taxonomies and editor role settings. – Max Yudin Aug 17 '16 at 11:16
0

What you need to do is to make custom user meta fields.

Links these metafields to a custom category linked to your custom post type.

Use this code for a checkbox feeling:

<input  type="checkbox" id="category-<?php echo $post_type->term_id ?>" <?php if($user_cats[0] && in_array( $post_type->term_id, $user_cats[0] )) echo 'checked=checked';?> 
            name="categories[]" value="<?php echo $post_type->term_id;?>"/>

Every custom category you make in the custom post type will be linked to the users profile. this way you can assign posts to a certain user.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.