WordPress.org

Make WordPress Core

Opened 3 months ago

Last modified 3 months ago

#50108 new defect (bug)

Custom Post Type with public => false still generates/reserves title as permalink

Reported by: TBschen Owned by:
Milestone: Awaiting Review Priority: normal
Severity: minor Version: 5.4.1
Component: Editor Keywords:
Focuses: Cc:

Description

A message with a permalink is still shown/generated after publishing a post of a custom post type with public=>false.

prerequisite

  • Generate a basic custom post type like this
<?php
function teaser_post_type() {

        $labels = array(
                'name'                  => 'My Teasers'
        );
        $args = array(
                'label'                 => 'Teaser',
                'description'           => 'it is a custom post type',
                'labels'                => $labels,
                'supports'              => array( 'title', 'editor', 'custom-fields' ),
                'hierarchical'          => false,
                'public'                => false,
                'show_ui'               => true,
                'show_in_menu'          => true,
                'menu_position'         => 5,
                'menu_icon'             => 'dashicons-groups',
                'show_in_admin_bar'     => true,
                'show_in_nav_menus'     => false,
                'can_export'            => true,
                'has_archive'           => false,
                'exclude_from_search'   => true,
                'publicly_queryable'    => true,
                'capability_type'       => 'page',
                'show_in_rest'       => true,
        );
        register_post_type( 'teaser', $args );

}
add_action( 'init', 'teaser_post_type', 0 );

issue

  • create a post of the custom post type
  • type in a title and click on publish
  • it will ask if you're ready to publish, so click publish again
  • a new message appears: "%post_title% is now live" - below that is a generated permalink (domain.com/%post_type%/%post_name%/) (also "view post" and "copy link" buttons)

The permalink leads to a 404 page which is correct, but the generated permalink and buttons should not happen (at least not be shown in the message), because the custom post type is public=>false.

Change History (1)

#1 @SergeyBiryukov
3 months ago

  • Component changed from General to Editor

Hi there, welcome back to WordPress Trac! Thanks for the report.

This was fixed for the classic editor in [33666] / #17609, but apparently needs to be fixed for the block editor now.

Note: See TracTickets for help on using tickets.