Make WordPress Core


Ignore:
Timestamp:
02/13/2016 03:50:37 AM (9 years ago)
Author:
boonebgorges
Message:

Introduce publicly_queryable taxonomy argument.

Taxonomies registered as publicly_queryable can be queried as taxonomy
archives.

If not provided explicitly, the value of publicly_queryable is inherited
from public.

Props Chouby.
Fixes #34491.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/taxonomy.php

    r36516 r36525  
    289289 *                                                Default empty array.
    290290 *     @type string        $description           A short descriptive summary of what the taxonomy is for. Default empty.
    291  *     @type bool          $public                Whether the taxonomy is publicly queryable. Default true.
     291 *     @type bool          $public                Whether a taxonomy is intended for use publicly either via
     292 *                                                the admin interface or by front-end users. The default settings
     293 *                                                of `$publicly_queryable`, `$show_ui`, and `$show_in_nav_menus`
     294 *                                                are inherited from `$public`.
     295 *     @type bool          $publicly_queryable    Whether the taxonomy is publicly queryable.
     296 *                                                If not set, the default is inherited from `$public`
    292297 *     @type bool          $hierarchical          Whether the taxonomy is hierarchical. Default false.
    293298 *     @type bool          $show_ui               Whether to generate and allow a UI for managing terms in this taxonomy in
     
    363368        'description'           => '',
    364369        'public'                => true,
     370        'publicly_queryable'    => null,
    365371        'hierarchical'          => false,
    366372        'show_ui'               => null,
     
    384390    }
    385391
    386     // Non-public taxonomies should not register query vars, except in the admin.
    387     if ( false !== $args['query_var'] && ( is_admin() || false !== $args['public'] ) && ! empty( $wp ) ) {
     392    // If not set, default to the setting for public.
     393    if ( null === $args['publicly_queryable'] ) {
     394        $args['publicly_queryable'] = $args['public'];
     395    }
     396
     397    // Non-publicly queryable taxonomies should not register query vars, except in the admin.
     398    if ( false !== $args['query_var'] && ( is_admin() || false !== $args['publicly_queryable'] ) && ! empty( $wp ) ) {
    388399        if ( true === $args['query_var'] )
    389400            $args['query_var'] = $taxonomy;
Note: See TracChangeset for help on using the changeset viewer.