Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ public static function get_config_schema() {
'public' => array( 'type' => 'boolean' ),
'hierarchical' => array( 'type' => 'boolean' ),
'has_archive' => array( 'type' => 'boolean' ),
'show_in_rest' => array( 'type' => 'boolean' ),
// Caps payload size; well above any reasonable description.
'description' => array(
'type' => 'string',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ public static function get_config_schema() {
'show_tagcloud' => array( 'type' => 'boolean' ),
'show_in_quick_edit' => array( 'type' => 'boolean' ),
'show_admin_column' => array( 'type' => 'boolean' ),
'show_in_rest' => array( 'type' => 'boolean' ),
'sort' => array( 'type' => 'boolean' ),
'default_term' => array(
'type' => 'object',
Expand Down
2 changes: 1 addition & 1 deletion lib/experimental/content-types/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ function gutenberg_build_user_taxonomy_args( WP_Post $record ) {
$args[ $key ] = (bool) $config[ $key ];
}
}
$args['show_in_rest'] = isset( $config['show_in_rest'] ) ? (bool) $config['show_in_rest'] : true;
$args['show_in_rest'] = true;

if ( isset( $config['default_term']['name'] ) ) {
$default_term_name = sanitize_text_field( (string) $config['default_term']['name'] );
Expand Down
2 changes: 1 addition & 1 deletion lib/experimental/content-types/post-types.php
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ function gutenberg_build_user_post_type_args( WP_Post $record ) {
'public' => ! empty( $config['public'] ),
'hierarchical' => $is_hierarchical,
'has_archive' => ! empty( $config['has_archive'] ),
'show_in_rest' => isset( $config['show_in_rest'] ) ? (bool) $config['show_in_rest'] : true,
'show_in_rest' => true,
'supports' => $supports,
);

Expand Down
2 changes: 0 additions & 2 deletions packages/content-types/src/post-types/edit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ import {
removeFeaturedImageField,
searchItemsField,
setFeaturedImageField,
showInRestField,
supportsField,
uploadedToThisItemField,
useFeaturedImageField,
Expand Down Expand Up @@ -157,7 +156,6 @@ function PostTypePage( {
publicField,
hierarchicalField,
hasArchiveField,
showInRestField,
statusField,
// Labels
labelsActionsField,
Expand Down
11 changes: 0 additions & 11 deletions packages/content-types/src/post-types/fields/general.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,6 @@ export const hasArchiveField = createBooleanField(
}
);

export const showInRestField = createBooleanField(
'show_in_rest',
__( 'Show in REST API' ),
{
description: __(
'Required for the block editor. Disable only if posts of this type should not be available via the REST API.'
),
}
);

export const countField: Field< PostTypeFormData > = {
id: 'count',
label: __( 'Posts' ),
Expand Down Expand Up @@ -289,7 +279,6 @@ export const generalForm: Form = {
'public',
'hierarchical',
'has_archive',
'show_in_rest',
'status',
],
};
1 change: 0 additions & 1 deletion packages/content-types/src/post-types/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ export interface StoredConfig {
public?: boolean;
hierarchical?: boolean;
has_archive?: boolean;
show_in_rest?: boolean;
}

import type { ContentType } from '../types';
Expand Down
3 changes: 0 additions & 3 deletions packages/content-types/src/post-types/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ export const BLANK_RECORD: PostTypeFormData = {
public: true,
hierarchical: false,
has_archive: false,
show_in_rest: true,
},
};

Expand Down Expand Up @@ -203,7 +202,6 @@ export function toFormData( row: PostTypeRecord ): PostTypeFormData {
public: config.public ?? true,
hierarchical: config.hierarchical ?? false,
has_archive: config.has_archive ?? false,
show_in_rest: config.show_in_rest ?? true,
},
count: row.count,
};
Expand Down Expand Up @@ -232,7 +230,6 @@ export function serializeForSave( data: PostTypeFormData ) {
public: config.public,
hierarchical: config.hierarchical,
has_archive: config.has_archive,
show_in_rest: config.show_in_rest,
...( description !== '' ? { description } : {} ),
},
};
Expand Down
2 changes: 0 additions & 2 deletions packages/content-types/src/taxonomies/edit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ import {
showInMenuField,
showInNavMenusField,
showInQuickEditField,
showInRestField,
showTagcloudField,
showUiField,
sortField,
Expand Down Expand Up @@ -160,7 +159,6 @@ function TaxonomyPage( {
statusField,
// Visibility
publicField,
showInRestField,
publiclyQueryableField,
showUiField,
showInMenuField,
Expand Down
11 changes: 0 additions & 11 deletions packages/content-types/src/taxonomies/fields/visibility.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,6 @@ export const publicField = createBooleanField( 'public', __( 'Public' ), {
),
} );

export const showInRestField = createBooleanField(
'show_in_rest',
__( 'Show in REST API' ),
{
description: __(
'Required for the block editor. Turn off only for taxonomies that should not be exposed via REST.'
),
}
);

export const publiclyQueryableField = createBooleanField(
'publicly_queryable',
__( 'Publicly queryable' ),
Expand Down Expand Up @@ -101,7 +91,6 @@ export const showTagcloudField = createBooleanField(

export const visibilityFormFields: Form[ 'fields' ] = [
'public',
'show_in_rest',
'publicly_queryable',
'show_ui',
'show_in_menu',
Expand Down
1 change: 0 additions & 1 deletion packages/content-types/src/taxonomies/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ export interface StoredConfig {
show_tagcloud: boolean;
show_in_quick_edit: boolean;
show_admin_column: boolean;
show_in_rest: boolean;
sort?: boolean;
default_term?: { name: string };
}
Expand Down
3 changes: 0 additions & 3 deletions packages/content-types/src/taxonomies/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ export const BLANK_RECORD: TaxonomyFormData = {
show_tagcloud: true,
show_in_quick_edit: true,
show_admin_column: false,
show_in_rest: true,
sort: false,
default_term_enabled: false,
default_term: { name: '' },
Expand Down Expand Up @@ -161,7 +160,6 @@ export function toFormData( row: TaxonomyRecord ): TaxonomyFormData {
show_tagcloud: config.show_tagcloud,
show_in_quick_edit: config.show_in_quick_edit,
show_admin_column: config.show_admin_column,
show_in_rest: config.show_in_rest,
sort: !! config.sort,
default_term_enabled: defaultTermName !== '',
default_term: { name: defaultTermName },
Expand Down Expand Up @@ -207,7 +205,6 @@ export function serializeForSave( data: TaxonomyFormData ) {
show_tagcloud: config.show_tagcloud,
show_in_quick_edit: config.show_in_quick_edit,
show_admin_column: config.show_admin_column,
show_in_rest: config.show_in_rest,
sort: config.sort,
...( description !== '' ? { description } : {} ),
...( includeDefaultTerm
Expand Down
1 change: 0 additions & 1 deletion packages/content-types/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export interface ContentType {
description: string;
public: boolean;
hierarchical: boolean;
show_in_rest: boolean;
};
}

Expand Down
23 changes: 0 additions & 23 deletions test/e2e/specs/admin/user-taxonomies.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ async function createUserTaxonomy( requestUtils ) {
show_tagcloud: true,
show_in_quick_edit: true,
show_admin_column: false,
show_in_rest: true,
},
} );
}
Expand Down Expand Up @@ -228,28 +227,6 @@ test.describe( 'User taxonomies', () => {
).toHaveCount( 0 );
} );

test( 'turning `Show in REST API` off blocks the taxonomy from the REST API', async ( {
page,
requestUtils,
} ) => {
await page.getByRole( 'button', { name: 'Visibility' } ).click();
await page
.getByRole( 'checkbox', { name: 'Show in REST API' } )
.click();
await page.getByRole( 'button', { name: 'Save' } ).click();
await expect( page.getByTestId( 'snackbar' ).last() ).toContainText(
'"Genres" taxonomy updated.'
);

const result = await requestUtils
.rest( {
path: '/wp/v2/taxonomies/genre',
method: 'GET',
} )
.catch( ( error ) => error );
expect( result.code ).toBe( 'rest_forbidden' );
} );

test( 'turning `Publicly queryable` off blocks the front-end term archive', async ( {
page,
} ) => {
Expand Down
Loading