Make WordPress Core

Opened 10 years ago

Last modified 5 months ago

#39651 new defect (bug)

Find Posts modal does not show post-type labels correctly

Reported by: arkonisus Owned by:
Priority: normal Milestone: Future Release
Component: Administration Version: 4.7.1
Severity: normal Keywords: has-patch
Cc: Focuses:

Description

The screenshot shows the output of four different posts in the Find Posts Modal. The last two post are correct, at the first and second post the post-type-label (e.g. cpt_example) is missing. The problem is the post-type parameter "public", if it is set to "false" the label will not be shown AND you will get the following PHP-Notice (if DEBUG is true):

Undefined index: cpt_example in ... /wp-admin/includes/ajax-actions.php on line 1803
Trying to get property of non-object in ... /wp-admin/includes/ajax-actions.php on line 1803

At the following code (1745 ff.) you will notice the reason of this issue: $post_types only includes public posts

<?php
/**
 * Ajax handler for querying posts for the Find Posts modal.
 *
 * @see window.findPosts
 *
 * @since 3.1.0
 */
function wp_ajax_find_posts() {
        check_ajax_referer( 'find-posts' );

        $post_types = get_post_types( array( 'public' => true ), 'objects' );
                                             ^^^^^^^^^^^^^^^^

The output of this modal shows all posts (public and unpublic), so i don't think that this "filter" was set for security reasons. In my opinion it must either show all posts correctly with their labels (which would be great) or it must suppress all "unpublic" posts completely.

Attachments (1)

find_posts.png​ (31.0 KB ) - added by arkonisus 10 years ago.

Download all attachments as: .zip

Change History (6)

@arkonisus
10 years ago

#1 @azaozz
10 years ago

  • Component Editor → Administration
  • Focuses administration removed
  • Keywords needs-patch added
  • Milestone Awaiting Review → Future Release

#2 @azaozz
10 years ago

Seems it will need to check if the current user can see private posts and exclude them if not.

#3 @SergeyBiryukov
10 years ago

  • Component Administration → Posts, Post Types

#4 @SirLouen
13 months ago

  • Component Posts, Post Types → Administration

This ticket was mentioned in ​PR #11770 on ​WordPress/wordpress-develop by ​@sukhendu2002.


5 months ago
#5

  • Keywords has-patch added; needs-patch removed
Note: See TracTickets for help on using tickets.