[wp-trac] [WordPress Trac] #42532: Custom post type : redirection bug after publish when cap edit_published_cpt is not set

WordPress Trac noreply at wordpress.org
Mon Nov 13 12:49:31 UTC 2017


#42532: Custom post type : redirection bug after publish when cap
edit_published_cpt is not set
-----------------------------+-----------------------------
 Reporter:  ajoah            |      Owner:
     Type:  defect (bug)     |     Status:  new
 Priority:  normal           |  Milestone:  Awaiting Review
Component:  Role/Capability  |    Version:  trunk
 Severity:  normal           |   Keywords:
  Focuses:  administration   |
-----------------------------+-----------------------------
 For a custom post type (movie for example), if user have capability
 `publish_movies` but not `edit_published_movies`, when he publishes a new
 movie, he is redirected to `http://example.com/edit.php` instead of
 `http://example.com/edit.php?post_type=movie`

 I make a gif to illustrate this :
 [[Image(https://media.giphy.com/media/xT0xeo4c4WIOKd4qFW/giphy.gif)]]

 ----

 User role capabilities  :
 * edit_movies
 * edit_others_movies
 * publish_movies
 * read
 Custom post type settings :
 {{{
         $labels = array(
                 "name" => __( "Movies", "twentyseventeen" ),
                 "singular_name" => __( "Movie", "twentyseventeen" ),
         );

         $args = array(
                 "label" => __( "Movies", "twentyseventeen" ),
                 "labels" => $labels,
                 "description" => "",
                 "public" => true,
                 "publicly_queryable" => true,
                 "show_ui" => true,
                 "show_in_rest" => false,
                 "rest_base" => "",
                 "has_archive" => false,
                 "show_in_menu" => true,
                 "exclude_from_search" => false,
                 "capability_type" => "movie",
                 "map_meta_cap" => true,
                 "hierarchical" => false,
                 "rewrite" => array( "slug" => "movie", "with_front" =>
 true ),
                 "query_var" => true,
                 "supports" => array( "title", "editor", "thumbnail" ),
         );

         register_post_type( "movie", $args );

 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/42532>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list