[wp-trac] [WordPress Trac] #39651: Find Posts modal does not show post-type labels correctly
WordPress Trac
noreply at wordpress.org
Fri Jan 20 11:59:23 UTC 2017
#39651: Find Posts modal does not show post-type labels correctly
----------------------------+-----------------------------
Reporter: arkonisus | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Editor | Version: 4.7.1
Severity: normal | Keywords:
Focuses: administration |
----------------------------+-----------------------------
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
<?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.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/39651>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list