WordPress.org

Making WordPress.org

Ticket #2627: 2627-make-disabled-page-visible.diff

File 2627-make-disabled-page-visible.diff, 1.2 KB (added by tellyworth, 16 months ago)

Make closed plugins visible from its slug page only.

  • class-plugin-directory.php

     
    266266                ) );
    267267                register_post_status( 'disabled', array(
    268268                        'label'                     => _x( 'Disabled', 'plugin status', 'wporg-plugins' ),
    269                         'public'                    => false,
     269                        'public'                    => true,
    270270                        'show_in_admin_status_list' => current_user_can( 'plugin_disable' ),
    271271                        'label_count'               => _n_noop( 'Disabled <span class="count">(%s)</span>', 'Disabled <span class="count">(%s)</span>', 'wporg-plugins' ),
    272272                ) );
     
    789789                        }, 10, 2 );
    790790                }
    791791
     792                // Allow anyone to view a disabled plugin directly from its page. It won't show in search results or lists.
     793                if ( !empty( $wp_query->query_vars['name'] ) ) {
     794                        $wp_query->query_vars['post_status'][] = 'disabled';
     795                        $wp_query->query_vars['post_status'] = array_unique( $wp_query->query_vars['post_status'] );
     796                }
     797
    792798                // By default, all archives are sorted by active installs
    793799                if ( $wp_query->is_archive() && empty( $wp_query->query_vars['orderby'] ) ) {
    794800                        $wp_query->query_vars['orderby']  = 'meta_value_num';