From d6923d285c1aedf1e235b3c878a005c674395165 Mon Sep 17 00:00:00 2001 From: Gary Pendergast Date: Thu, 22 Feb 2018 00:24:31 +0000 Subject: [PATCH] REST API: Show taxonomy visibility settings. For Gutenberg and other admin-type interfaces, it's useful to be able to see the visibility settings for taxonomies. Props joehoyle, pento. Fixes #42707. Built from https://develop.svn.wordpress.org/trunk@42729 git-svn-id: http://core.svn.wordpress.org/trunk@42559 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- .../class-wp-rest-taxonomies-controller.php | 41 +++++++++++++++++++ wp-includes/version.php | 2 +- 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/wp-includes/rest-api/endpoints/class-wp-rest-taxonomies-controller.php b/wp-includes/rest-api/endpoints/class-wp-rest-taxonomies-controller.php index 14384814ee..dbce333ab4 100644 --- a/wp-includes/rest-api/endpoints/class-wp-rest-taxonomies-controller.php +++ b/wp-includes/rest-api/endpoints/class-wp-rest-taxonomies-controller.php @@ -191,6 +191,14 @@ class WP_REST_Taxonomies_Controller extends WP_REST_Controller { 'show_cloud' => $taxonomy->show_tagcloud, 'hierarchical' => $taxonomy->hierarchical, 'rest_base' => $base, + 'visibility' => array( + 'public' => (bool) $taxonomy->public, + 'publicly_queryable' => (bool) $taxonomy->publicly_queryable, + 'show_admin_column' => (bool) $taxonomy->show_admin_column, + 'show_in_nav_menus' => (bool) $taxonomy->show_in_nav_menus, + 'show_in_quick_edit' => (bool) $taxonomy->show_in_quick_edit, + 'show_ui' => (bool) $taxonomy->show_ui, + ), ); $context = ! empty( $request['context'] ) ? $request['context'] : 'view'; @@ -295,6 +303,39 @@ class WP_REST_Taxonomies_Controller extends WP_REST_Controller { 'context' => array( 'view', 'edit', 'embed' ), 'readonly' => true, ), + 'visibility' => array( + 'description' => __( 'The visibility settings for the taxomonmy.' ), + 'type' => 'object', + 'context' => array( 'edit' ), + 'readonly' => true, + 'properties' => array( + 'public' => array( + 'description' => 'Whether a taxonomy is intended for use publicly either via the admin interface or by front-end users.', + 'type' => 'boolean', + ), + 'publicly_queryable' => array( + 'description' => 'Whether the taxonomy is publicly queryable.', + 'type' => 'boolean', + ), + 'show_ui' => array( + 'description' => 'Whether to generate a default UI for managing this taxonomy.', + 'type' => 'boolean', + ), + 'show_admin_column' => array( + 'description' => 'Whether to allow automatic creation of taxonomy columns on associated post-types table.', + 'type' => 'boolean', + ), + 'show_in_nav_menus' => array( + 'description' => 'Whether to make the taxonomy available for selection in navigation menus.', + 'type' => 'boolean', + ), + 'show_in_quick_edit' => array( + 'description' => 'Whether to show the taxonomy in the quick/bulk edit panel.', + 'type' => 'boolean', + ), + + ), + ), ), ); return $this->add_additional_fields_schema( $schema ); diff --git a/wp-includes/version.php b/wp-includes/version.php index 2ad311a5d0..6cbf4af267 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '5.0-alpha-42728'; +$wp_version = '5.0-alpha-42729'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.